earl-badge

Creates SVG badges for EARL files.

Usage no npm install needed!

<script type="module">
  import earlBadge from 'https://cdn.skypack.dev/earl-badge';
</script>

README

EARL-Badge.js

Build Status Coverage Status npm version Greenkeeper badge

This tool creates SVG badges for EARL test reports, for representing the specification compliance of a certain tool. These badges represent the percentage of passed tests for a specification's test suite for a given tool.

For example, a badge representing the JSON-LD 1.1 spec compliance could look as follows:

npm version

These EARL reports can be generated using a variety of tools in different programming languages, such as rdf-test-suite.js.

Installation

Global

This allows the tool to be used from the CLI.

$ yarn global add earl-badge

or

$ npm install -g earl-badge

Local

This allows the tool to be used as a library.

$ yarn add earl-badge

or

$ npm install earl-badge

Usage

This tool can either be used to generate SVG files from command line, or from code.

CLI

This tool assumes that you have an EARL test report file for a tool.

Assuming that you have an EARL file at mytool-earl.ttl, where your tool is identified in the EARL file by http://example.org/mytool, and your tool implements the JSON-LD 1.1 specification, you can execute this tool as follows:

$ earl-badge "JSON-LD 1.1" http://example.org/mytool mytool-earl.ttl

This tool supports EARL files in most RDF serializations, as long as they are supported by rdf-parse.

Code

The SVG generation can also be called from code as follows:

import { BadgeGeneratorEarl } from "earl-badge";

const svgString = await new BadgeGeneratorEarl().createSvgBadge({
  filePath: 'mytool-earl.ttl',
  specName: 'JSON-LD 1.1',
  testSubject: 'http://example.org/mytool',
});

License

This software is written by Ruben Taelman.

This code is released under the MIT license.