Registry / testing / mutation-testing-report-schema

mutation-testing-report-schema

JSON →
library3.8.0jsnpmunverified

A JSON Schema defining the format for mutation testing reports, currently at version 3.8.0. It is part of the Stryker Mutator ecosystem and provides a standardized structure for representing mutation testing results, including mutants, tests, and coverage. This schema is used by mutation testing tools to ensure interoperability. The package ships TypeScript types for easy integration with TypeScript projects. It is released as part of the Stryker mutation-testing-elements monorepo, with a cadence aligned to Stryker releases. It offers a single, validated schema that can be consumed via JSON Schema validators like AJV or directly imported as a TypeScript module.

npm install mutation-testing-report-schema
INSTALL
IMPORT
SIG · MUTATION-TESTING-R
M
mutation-testing-report-schema
testingjavascriptv3.8.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

schema
import { schema } from 'mutation-testing-report-schema';
import schema from 'mutation-testing-report-schema';
The module exports a named export 'schema', not a default export.
MutationTestResult
import { MutationTestResult } from 'mutation-testing-report-schema';
import MutationTestResult from 'mutation-testing-report-schema';
This is a TypeScript type, not a runtime value.
reportSchema
import { schema } from 'mutation-testing-report-schema';
const schema = require('mutation-testing-report-schema');
CommonJS require will not work with the default export; use named import.

Validates a mutation testing report JSON object against the schema using AJV.

import { schema } from 'mutation-testing-report-schema'; import Ajv from 'ajv'; const ajv = new Ajv(); ajv.addSchema(schema, 'mutation-testing-report'); const report = { schemaVersion: '1.0', thresholds: { high: 80, low: 60 }, files: { 'src/index.js': { language: 'javascript', source: 'function add(a,b) { return a + b; }', mutants: [{ id: '1', mutatorName: 'arithmeticOperator', replacement: '-', location: { start: { line: 1, column: 24 }, end: { line: 1, column: 25 } }, status: 'Killed' }] } } }; const valid = ajv.validate('mutation-testing-report', report); if (!valid) { console.error(ajv.errorsText()); }
Debug
Known issues
gotchaThe 'schema' export is a JSON object, not a function. Do not try to call it.
fix
Import { schema } and use it as data, e.g., with AJV's addSchema method.
affects: >=1.0.0
gotchaThe schema version has changed between major releases. Ensure your report object matches the schema version expected by the library.
fix
Check the 'MutationTestResult' type for required fields per version.
affects: >=1.0.0
deprecatedSome older fields like 'mutatedLines' have been replaced by 'location' objects. Using deprecated fields may cause validation errors.
fix
Migrate from 'mutatedLines' to 'location' with start/end line and column.
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'validate')
Trying to call schema.validate() directly, but schema is a plain object.
fix
Use AJV or another JSON Schema validator: import Ajv; const ajv = new Ajv(); ajv.addSchema(schema, 'key'); ajv.validate('key', report);
Cannot find module 'mutation-testing-report-schema'
Missing npm install or ESM import issue in CommonJS environment.
fix
Run 'npm install mutation-testing-report-schema' and use correct import syntax: import { schema } from 'mutation-testing-report-schema';
Schema validation error: data must have required property 'schemaVersion'
The report object does not include the required 'schemaVersion' field.
fix
Add a 'schemaVersion' field (string) to your report object, e.g., '1.0'.
Upgrade
Version history
3.8.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
mutation-testing-report-schema — npm install mutation-testing-report-schema · libregistry