What is mutation-testing-report-schema?
The mutation-testing-report-schema npm package provides a schema for mutation testing reports. It is used to validate and ensure consistency in the format of reports generated by mutation testing tools. Mutation testing is a method of software testing where the source code is modified in small ways to test if the existing test cases can detect the changes.
What are mutation-testing-report-schema's main functionalities?
Schema Validation
The mutation-testing-report-schema provides a JSON schema to validate mutation testing reports. This ensures that the reports adhere to a standard structure, making it easier to process and analyze them.
{ "type": "object", "properties": { "files": { "type": "object" }, "schemaVersion": { "type": "string" } }, "required": ["files", "schemaVersion"] }
Consistent Report Structure
By using the schema, reports generated by different mutation testing tools can have a consistent structure. This example shows a simple report structure with a file containing mutants and their statuses.
{ "files": { "example.js": { "mutants": [ { "id": "1", "status": "Killed", "mutatorName": "StringLiteral" } ] } }, "schemaVersion": "1.0" }
Other packages similar to mutation-testing-report-schema
mutation-testing-elements
The mutation-testing-elements package provides web components to visualize mutation testing reports. While mutation-testing-report-schema focuses on the structure and validation of the reports, mutation-testing-elements is about rendering and displaying the reports in a user-friendly way.
stryker
Stryker is a mutation testing framework for JavaScript and TypeScript. It generates mutation testing reports that can be validated against the mutation-testing-report-schema. Stryker focuses on the generation and execution of mutation tests, whereas mutation-testing-report-schema is concerned with the report format.
Mutation testing elements schema
The json schema for mutation testing elements.
The schema can be found here.
JavaScript
Install it with npm like this:
$ npm i mutation-testing-report-schema
Use it from typescript or js (with babel)
import { schema } from 'mutation-testing-elements-schema';
For example, use AJV:
const schemaValidator = new Ajv();
schemaValidator.addSchema(schema, 'mutation-testing-report-schema');
schemaValidator.validate('mutation-testing-report-schema', { });
Other languages
Download the schema using https://www.unpkg.com/mutation-testing-report-schema@VERSION/dist/src/mutation-testing-report-schema.json
For the current version, see package.json.