earl-badge v1.0.0
EARL-Badge.js
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:
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-badgeor
$ npm install -g earl-badgeLocal
This allows the tool to be used as a library.
$ yarn add earl-badgeor
$ npm install earl-badgeUsage
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.ttlThis 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.
6 years ago