UNPKG

@stryker-mutator/jest-runner

Version:

A plugin to use the jest test runner and framework in Stryker, the JavaScript mutation testing framework

26 lines 989 B
import { pluginTokens } from '../plugin-di.js'; export class JestTestAdapter { jestWrapper; static inject = [pluginTokens.jestWrapper]; constructor(jestWrapper) { this.jestWrapper = jestWrapper; } async run({ jestConfig, fileNamesUnderTest, testFiles, testNamePattern, testLocationInResults, }) { const config = JSON.stringify(jestConfig); const testFilesToRun = testFiles ?? fileNamesUnderTest ?? []; const shouldFindRelatedTests = !testFiles && !!fileNamesUnderTest; const result = await this.jestWrapper.runCLI({ $0: 'stryker', _: testFilesToRun, findRelatedTests: shouldFindRelatedTests, config, runInBand: true, silent: true, passWithNoTests: true, testNamePattern, testLocationInResults, }, [jestConfig.rootDir ?? process.cwd()]); return result; } } //# sourceMappingURL=jest-test-adapter.js.map