A plugin to use the jest test runner and framework in Stryker, the JavaScript mutation testing framework
—
Core plugin registration and validation schema for Stryker integration. Provides the main entry point for using Jest as a test runner in Stryker mutation testing.
The main plugin export that registers Jest as a test runner with Stryker's plugin system.
/**
* Array of Stryker plugin declarations for Jest test runner
* Contains the Jest test runner factory plugin registration
*/
export const strykerPlugins: Array<PluginDeclaration>;Usage Example:
import { strykerPlugins } from "@stryker-mutator/jest-runner";
// Plugins are automatically registered when the package is loaded
// Used internally by Stryker to discover and load the Jest test runner
console.log(strykerPlugins); // [{ kind: 'TestRunner', name: 'jest', factory: ... }]JSON schema for validating Jest runner configuration options.
/**
* Validation schema for Jest runner options
* Loaded from schema/jest-runner-options.json
*/
export const strykerValidationSchema: JestRunnerOptionsSchema;Usage Example:
import { strykerValidationSchema } from "@stryker-mutator/jest-runner";
// Schema is used internally by Stryker for configuration validation
// Contains validation rules for jest configuration options
console.log(strykerValidationSchema.properties.jest);interface PluginDeclaration {
kind: PluginKind.TestRunner;
name: 'jest';
factory: typeof jestTestRunnerFactory;
}
enum PluginKind {
TestRunner = 'TestRunner',
// ... other plugin types
}interface JestRunnerOptionsSchema {
$schema: string;
type: 'object';
title: 'JestRunnerOptions';
additionalItems: boolean;
properties: {
jest: JestOptionsSchema;
};
definitions: {
jestProjectType: JestProjectTypeSchema;
};
}
interface JestOptionsSchema {
title: 'JestOptions';
description: string;
type: 'object';
default: {};
properties: {
projectType: { $ref: '#/definitions/jestProjectType' };
configFile: { description: string; type: 'string' };
config: { description: string; type: 'object' };
enableFindRelatedTests: { description: string; type: 'boolean'; default: true };
};
additionalProperties: boolean;
}The plugin automatically sets up the testing environment:
// Automatically set when the package is loaded
process.env.BABEL_ENV = 'test';This ensures that Babel transformations are applied correctly for Jest testing within the Stryker environment.
The plugin integrates with Stryker through the dependency injection system:
strykerPlugins exportjestTestRunnerFactory to create test runner instancesstrykerValidationSchema to validate Jest configurationInstall with Tessl CLI
npx tessl i tessl/npm-stryker-mutator--jest-runner