diff --git a/packages/jest-runner/package.json b/packages/jest-runner/package.json index 0c55cba964..cd03ba1842 100644 --- a/packages/jest-runner/package.json +++ b/packages/jest-runner/package.json @@ -4,7 +4,7 @@ "description": "A plugin to use the jest test runner and framework in Stryker, the JavaScript mutation testing framework", "main": "src/index.js", "scripts": { - "test": "nyc --exclude-after-remap=false --check-coverage --reporter=html --report-dir=reports/coverage --lines 80 --functions 80 --branches 75 npm run mocha", + "test": "nyc --exclude-after-remap=false --check-coverage --reporter=html --report-dir=reports/coverage --lines 80 --functions 80 --branches 70 npm run mocha", "mocha": "mocha \"test/helpers/**/*.js\" \"test/unit/**/*.js\" && mocha --timeout 30000 \"test/helpers/**/*.js\" \"test/integration/**/*.js\"", "stryker": "node ../core/bin/stryker run" }, diff --git a/packages/jest-runner/src/JestTestRunner.ts b/packages/jest-runner/src/JestTestRunner.ts index e11d893b99..7ba3a5cdf1 100644 --- a/packages/jest-runner/src/JestTestRunner.ts +++ b/packages/jest-runner/src/JestTestRunner.ts @@ -5,11 +5,9 @@ import { RunOptions, RunResult, RunStatus, TestResult, TestRunner, TestStatus } import { jestTestAdapterFactory } from './jestTestAdapters'; import JestTestAdapter from './jestTestAdapters/JestTestAdapter'; -import { JestRunnerOptionsWithStrykerOptions } from './JestRunnerOptionsWithStrykerOptions'; import JestConfigLoader from './configLoaders/JestConfigLoader'; import { configLoaderToken, processEnvToken, jestTestAdapterToken, jestVersionToken } from './pluginTokens'; import { configLoaderFactory } from './configLoaders'; -import JEST_OVERRIDE_OPTIONS from './jestOverrideOptions'; export function jestTestRunnerFactory(injector: Injector) { return injector @@ -34,30 +32,35 @@ export default class JestTestRunner implements TestRunner { private readonly jestTestAdapter: JestTestAdapter, configLoader: JestConfigLoader ) { - const jestOptions = options as JestRunnerOptionsWithStrykerOptions; - // Get jest configuration from stryker options and assign it to jestConfig - const configFromFile = configLoader.loadConfig(); - this.jestConfig = this.mergeConfigSettings(configFromFile, (jestOptions.jest.config as any) || {}); - - // Get enableFindRelatedTests from stryker jest options or default to true - this.enableFindRelatedTests = jestOptions.jest.enableFindRelatedTests; - if (this.enableFindRelatedTests === undefined) { - this.enableFindRelatedTests = true; - } - - if (this.enableFindRelatedTests) { - this.log.debug('Running jest with --findRelatedTests flag. Set jest.enableFindRelatedTests to false to run all tests on every mutant.'); - } else { - this.log.debug( - 'Running jest without --findRelatedTests flag. Set jest.enableFindRelatedTests to true to run only relevant tests on every mutant.' - ); - } - - // basePath will be used in future releases of Stryker as a way to define the project root - // Default to process.cwd when basePath is not set for now, should be removed when issue is solved - // https://github.com/stryker-mutator/stryker/issues/650 - this.jestConfig.rootDir = (options.basePath as string) || process.cwd(); - this.log.debug(`Project root is ${this.jestConfig.rootDir}`); + const errorMessage = + 'This version of Stryker does not (yet) support Jest, sorry! Follow https://github.com/stryker-mutator/stryker/issues/2321 for the latest status.'; + this.log.error(errorMessage); + throw new Error(errorMessage); + + // const jestOptions = options as JestRunnerOptionsWithStrykerOptions; + // // Get jest configuration from stryker options and assign it to jestConfig + // const configFromFile = configLoader.loadConfig(); + // this.jestConfig = this.mergeConfigSettings(configFromFile, (jestOptions.jest.config as any) || {}); + + // // Get enableFindRelatedTests from stryker jest options or default to true + // this.enableFindRelatedTests = jestOptions.jest.enableFindRelatedTests; + // if (this.enableFindRelatedTests === undefined) { + // this.enableFindRelatedTests = true; + // } + + // if (this.enableFindRelatedTests) { + // this.log.debug('Running jest with --findRelatedTests flag. Set jest.enableFindRelatedTests to false to run all tests on every mutant.'); + // } else { + // this.log.debug( + // 'Running jest without --findRelatedTests flag. Set jest.enableFindRelatedTests to true to run only relevant tests on every mutant.' + // ); + // } + + // // basePath will be used in future releases of Stryker as a way to define the project root + // // Default to process.cwd when basePath is not set for now, should be removed when issue is solved + // // https://github.com/stryker-mutator/stryker/issues/650 + // this.jestConfig.rootDir = (options.basePath as string) || process.cwd(); + // this.log.debug(`Project root is ${this.jestConfig.rootDir}`); } public async run(options: RunOptions): Promise { @@ -116,13 +119,13 @@ export default class JestTestRunner implements TestRunner { } } - private mergeConfigSettings(configFromFile: Jest.Configuration, config: Jest.Configuration) { - const stringify = (obj: Record) => JSON.stringify(obj, null, 2); - this.log.trace( - `Merging file-based config ${stringify(configFromFile)} - with custom config ${stringify(config)} - and default (internal) stryker config ${JEST_OVERRIDE_OPTIONS}` - ); - return Object.assign(configFromFile, config, JEST_OVERRIDE_OPTIONS); - } + // private mergeConfigSettings(configFromFile: Jest.Configuration, config: Jest.Configuration) { + // const stringify = (obj: Record) => JSON.stringify(obj, null, 2); + // this.log.trace( + // `Merging file-based config ${stringify(configFromFile)} + // with custom config ${stringify(config)} + // and default (internal) stryker config ${JEST_OVERRIDE_OPTIONS}` + // ); + // return Object.assign(configFromFile, config, JEST_OVERRIDE_OPTIONS); + // } } diff --git a/packages/jest-runner/test/integration/JestTestRunner.it.spec.ts b/packages/jest-runner/test/integration/JestTestRunner.it.spec.ts index 48c75655cd..c03ff6f972 100644 --- a/packages/jest-runner/test/integration/JestTestRunner.it.spec.ts +++ b/packages/jest-runner/test/integration/JestTestRunner.it.spec.ts @@ -1,111 +1,111 @@ -import * as path from 'path'; - -import { expect } from 'chai'; -import { RunOptions, RunStatus, TestStatus } from '@stryker-mutator/api/test_runner'; -import * as sinon from 'sinon'; -import { commonTokens } from '@stryker-mutator/api/plugin'; -import { factory, testInjector } from '@stryker-mutator/test-helpers'; - -import JestTestRunner, { jestTestRunnerFactory } from '../../src/JestTestRunner'; -import { JestRunnerOptionsWithStrykerOptions } from '../../src/JestRunnerOptionsWithStrykerOptions'; -import { JestOptions } from '../../src-generated/jest-runner-options'; -import { createJestOptions } from '../helpers/producers'; - -const paths = require('react-scripts-ts/config/paths'); -// It's a bit hacky, but we need to tell create-react-app-ts to pick a different tsconfig.test.json -paths.appTsTestConfig = require.resolve('../../testResources/reactTsProject/tsconfig.test.json'); - -// Get the actual project root, since we will stub process.cwd later on -const jestProjectRoot = process.cwd(); - -// Needed for Jest in order to run tests -process.env.BABEL_ENV = 'test'; - -describe(`${JestTestRunner.name} integration test`, () => { - // Set timeout for integration tests to 10 seconds for travis - let processCwdStub: sinon.SinonStub; - - const runOptions: RunOptions = { timeout: 0 }; - - // Names of the tests in the example projects - const testNames = [ - 'Add should be able to add two numbers', - 'Add should be able to add one to a number', - 'Add should be able negate a number', - 'Add should be able to recognize a negative number', - 'Add should be able to recognize that 0 is not a negative number', - 'Circle should have a circumference of 2PI when the radius is 1', - ]; - - beforeEach(() => { - processCwdStub = sinon.stub(process, 'cwd'); - }); - - function createSut(overrides?: Partial) { - const options: JestRunnerOptionsWithStrykerOptions = factory.strykerWithPluginOptions({ - jest: createJestOptions(overrides), - }); - return testInjector.injector.provideValue(commonTokens.options, options).injectFunction(jestTestRunnerFactory); - } - - it('should run tests on the example React + TypeScript project', async () => { - processCwdStub.returns(getProjectRoot('reactTsProject')); - const jestTestRunner = createSut({ projectType: 'react-ts' }); - - const result = await jestTestRunner.run(runOptions); - - expect(result.status).to.equal(RunStatus.Complete); - expect(result).to.have.property('tests'); - expect(result.tests).to.be.an('array').that.is.not.empty; - expect(result.tests[0].name).to.equal('renders without crashing'); - expect(result.tests[0].status).to.equal(TestStatus.Success); - expect(result.tests[0].timeSpentMs).to.be.above(-1); - expect(result.tests[0].failureMessages).to.be.an('array').that.is.empty; - expect(result.status).to.equal(RunStatus.Complete); - }); - - it('should run tests on the example custom project using package.json', async () => { - processCwdStub.returns(getProjectRoot('exampleProject')); - const jestTestRunner = createSut(); - - const result = await jestTestRunner.run(runOptions); - - expect(result.errorMessages, `Errors were: ${result.errorMessages}`).lengthOf(0); - expect(result).to.have.property('tests'); - expect(result.tests).to.be.an('array').with.length(testNames.length); - - for (const test of result.tests) { - expect(testNames).to.include(test.name); - expect(test.status).to.equal(TestStatus.Success); - expect(test.timeSpentMs).to.be.above(-1); - expect(test.failureMessages).to.be.an('array').that.is.empty; - } - - expect(result.status).to.equal(RunStatus.Complete); - }); - - it('should run tests on the example custom project using jest.config.js', async () => { - processCwdStub.returns(getProjectRoot('exampleProjectWithExplicitJestConfig')); - - const jestTestRunner = createSut(); - - const result = await jestTestRunner.run(runOptions); - - expect(result.errorMessages, `Errors were: ${result.errorMessages}`).lengthOf(0); - expect(result).to.have.property('tests'); - expect(result.tests).to.be.an('array').with.length(testNames.length); - - for (const test of result.tests) { - expect(testNames).to.include(test.name); - expect(test.status).to.equal(TestStatus.Success); - expect(test.timeSpentMs).to.be.above(-1); - expect(test.failureMessages).to.be.an('array').that.is.empty; - } - - expect(result.status).to.equal(RunStatus.Complete); - }); -}); - -function getProjectRoot(testResource: string) { - return path.join(jestProjectRoot, 'testResources', testResource); -} +// import * as path from 'path'; + +// import { expect } from 'chai'; +// import { RunOptions, RunStatus, TestStatus } from '@stryker-mutator/api/test_runner'; +// import * as sinon from 'sinon'; +// import { commonTokens } from '@stryker-mutator/api/plugin'; +// import { factory, testInjector } from '@stryker-mutator/test-helpers'; + +// import JestTestRunner, { jestTestRunnerFactory } from '../../src/JestTestRunner'; +// import { JestRunnerOptionsWithStrykerOptions } from '../../src/JestRunnerOptionsWithStrykerOptions'; +// import { JestOptions } from '../../src-generated/jest-runner-options'; +// import { createJestOptions } from '../helpers/producers'; + +// const paths = require('react-scripts-ts/config/paths'); +// // It's a bit hacky, but we need to tell create-react-app-ts to pick a different tsconfig.test.json +// paths.appTsTestConfig = require.resolve('../../testResources/reactTsProject/tsconfig.test.json'); + +// // Get the actual project root, since we will stub process.cwd later on +// const jestProjectRoot = process.cwd(); + +// // Needed for Jest in order to run tests +// process.env.BABEL_ENV = 'test'; + +// describe(`${JestTestRunner.name} integration test`, () => { +// // Set timeout for integration tests to 10 seconds for travis +// let processCwdStub: sinon.SinonStub; + +// const runOptions: RunOptions = { timeout: 0 }; + +// // Names of the tests in the example projects +// const testNames = [ +// 'Add should be able to add two numbers', +// 'Add should be able to add one to a number', +// 'Add should be able negate a number', +// 'Add should be able to recognize a negative number', +// 'Add should be able to recognize that 0 is not a negative number', +// 'Circle should have a circumference of 2PI when the radius is 1', +// ]; + +// beforeEach(() => { +// processCwdStub = sinon.stub(process, 'cwd'); +// }); + +// function createSut(overrides?: Partial) { +// const options: JestRunnerOptionsWithStrykerOptions = factory.strykerWithPluginOptions({ +// jest: createJestOptions(overrides), +// }); +// return testInjector.injector.provideValue(commonTokens.options, options).injectFunction(jestTestRunnerFactory); +// } + +// it('should run tests on the example React + TypeScript project', async () => { +// processCwdStub.returns(getProjectRoot('reactTsProject')); +// const jestTestRunner = createSut({ projectType: 'react-ts' }); + +// const result = await jestTestRunner.run(runOptions); + +// expect(result.status).to.equal(RunStatus.Complete); +// expect(result).to.have.property('tests'); +// expect(result.tests).to.be.an('array').that.is.not.empty; +// expect(result.tests[0].name).to.equal('renders without crashing'); +// expect(result.tests[0].status).to.equal(TestStatus.Success); +// expect(result.tests[0].timeSpentMs).to.be.above(-1); +// expect(result.tests[0].failureMessages).to.be.an('array').that.is.empty; +// expect(result.status).to.equal(RunStatus.Complete); +// }); + +// it('should run tests on the example custom project using package.json', async () => { +// processCwdStub.returns(getProjectRoot('exampleProject')); +// const jestTestRunner = createSut(); + +// const result = await jestTestRunner.run(runOptions); + +// expect(result.errorMessages, `Errors were: ${result.errorMessages}`).lengthOf(0); +// expect(result).to.have.property('tests'); +// expect(result.tests).to.be.an('array').with.length(testNames.length); + +// for (const test of result.tests) { +// expect(testNames).to.include(test.name); +// expect(test.status).to.equal(TestStatus.Success); +// expect(test.timeSpentMs).to.be.above(-1); +// expect(test.failureMessages).to.be.an('array').that.is.empty; +// } + +// expect(result.status).to.equal(RunStatus.Complete); +// }); + +// it('should run tests on the example custom project using jest.config.js', async () => { +// processCwdStub.returns(getProjectRoot('exampleProjectWithExplicitJestConfig')); + +// const jestTestRunner = createSut(); + +// const result = await jestTestRunner.run(runOptions); + +// expect(result.errorMessages, `Errors were: ${result.errorMessages}`).lengthOf(0); +// expect(result).to.have.property('tests'); +// expect(result.tests).to.be.an('array').with.length(testNames.length); + +// for (const test of result.tests) { +// expect(testNames).to.include(test.name); +// expect(test.status).to.equal(TestStatus.Success); +// expect(test.timeSpentMs).to.be.above(-1); +// expect(test.failureMessages).to.be.an('array').that.is.empty; +// } + +// expect(result.status).to.equal(RunStatus.Complete); +// }); +// }); + +// function getProjectRoot(testResource: string) { +// return path.join(jestProjectRoot, 'testResources', testResource); +// } diff --git a/packages/jest-runner/test/unit/JestTestRunner.spec.ts b/packages/jest-runner/test/unit/JestTestRunner.spec.ts index 9fde80ad24..ba9a8bc680 100644 --- a/packages/jest-runner/test/unit/JestTestRunner.spec.ts +++ b/packages/jest-runner/test/unit/JestTestRunner.spec.ts @@ -1,184 +1,184 @@ -import { RunOptions, RunStatus, TestStatus } from '@stryker-mutator/api/test_runner'; -import { testInjector } from '@stryker-mutator/test-helpers'; -import { expect } from 'chai'; -import sinon from 'sinon'; - -import { JestTestAdapter } from '../../src/jestTestAdapters'; -import JestTestRunner from '../../src/JestTestRunner'; -import * as producers from '../helpers/producers'; -import { processEnvToken, jestTestAdapterToken, configLoaderToken } from '../../src/pluginTokens'; -import JestConfigLoader from '../../src/configLoaders/JestConfigLoader'; - -describe('JestTestRunner', () => { - const basePath = '/path/to/project/root'; - const runOptions: RunOptions = { timeout: 0 }; - - let jestTestAdapterMock: sinon.SinonStubbedInstance; - let jestConfigLoaderMock: sinon.SinonStubbedInstance; - let jestTestRunner: JestTestRunner; - let processEnvMock: NodeJS.ProcessEnv; - - beforeEach(() => { - jestTestAdapterMock = { run: sinon.stub() }; - jestTestAdapterMock.run.resolves({ results: { testResults: [] } }); - jestConfigLoaderMock = { loadConfig: sinon.stub() }; - jestConfigLoaderMock.loadConfig.resolves({}); - - testInjector.options.jest = { config: { property: 'value' } }; - testInjector.options.basePath = basePath; - - processEnvMock = { - NODE_ENV: undefined, - }; - - jestTestRunner = testInjector.injector - .provideValue(processEnvToken, processEnvMock) - .provideValue(jestTestAdapterToken, (jestTestAdapterMock as unknown) as JestTestAdapter) - .provideValue(configLoaderToken, jestConfigLoaderMock) - .injectClass(JestTestRunner); - }); - - it('should log the project root when constructing the JestTestRunner', () => { - expect(testInjector.logger.debug).calledWith(`Project root is ${basePath}`); - }); - - it('should call the run function with the provided config and the projectRoot', async () => { - await jestTestRunner.run(runOptions); - - expect(jestTestAdapterMock.run).called; - }); - - it('should call the jestTestRunner run method and return a correct runResult', async () => { - jestTestAdapterMock.run.resolves({ results: producers.createSuccessResult() }); - - const result = await jestTestRunner.run(runOptions); - - expect(result).to.deep.equal({ - errorMessages: [], - status: RunStatus.Complete, - tests: [ - { - failureMessages: [], - name: 'App renders without crashing', - status: TestStatus.Success, - timeSpentMs: 23, - }, - ], - }); - }); - - it('should call the jestTestRunner run method and return a skipped runResult', async () => { - jestTestAdapterMock.run.resolves({ results: producers.createPendingResult() }); - - const result = await jestTestRunner.run(runOptions); - - expect(result).to.deep.equal({ - errorMessages: [], - status: RunStatus.Complete, - tests: [ - { - failureMessages: [], - name: 'App renders without crashing', - status: TestStatus.Skipped, - timeSpentMs: 0, - }, - ], - }); - }); - - it('should call the jestTestRunner run method and return a todo runResult', async () => { - jestTestAdapterMock.run.resolves({ results: producers.createTodoResult() }); - - const result = await jestTestRunner.run(runOptions); - - expect(result).to.deep.equal({ - errorMessages: [], - status: RunStatus.Complete, - tests: [ - { - failureMessages: [], - name: 'App renders without crashing', - status: TestStatus.Success, - timeSpentMs: 4, - }, - { - failureMessages: [], - name: 'App renders without crashing with children', - status: TestStatus.Skipped, - timeSpentMs: 0, - }, - ], - }); - }); - - it('should call the jestTestRunner run method and return a negative runResult', async () => { - jestTestAdapterMock.run.resolves({ results: producers.createFailResult() }); - - const result = await jestTestRunner.run(runOptions); - - expect(result).to.deep.equal({ - errorMessages: ['test failed - App.test.js'], - status: RunStatus.Complete, - tests: [ - { - failureMessages: ['Fail message 1', 'Fail message 2'], - name: 'App render renders without crashing', - status: TestStatus.Failed, - timeSpentMs: 2, - }, - { - failureMessages: ['Fail message 3', 'Fail message 4'], - name: 'App render renders without crashing', - status: TestStatus.Failed, - timeSpentMs: 0, - }, - { - failureMessages: [], - name: 'App renders without crashing', - status: TestStatus.Success, - timeSpentMs: 23, - }, - ], - }); - }); - - it('should return an error result when a runtime error occurs', async () => { - jestTestAdapterMock.run.resolves({ results: { testResults: [], numRuntimeErrorTestSuites: 1 } }); - - const result = await jestTestRunner.run(runOptions); - - expect(result).to.deep.equal({ - errorMessages: [], - status: RunStatus.Error, - tests: [], - }); - }); - - it("should set process.env.NODE_ENV to 'test' when process.env.NODE_ENV is null", async () => { - await jestTestRunner.run(runOptions); - - expect(processEnvMock.NODE_ENV).to.equal('test'); - }); - - it('should keep the value set in process.env.NODE_ENV if not null', async () => { - processEnvMock.NODE_ENV = 'stryker'; - - await jestTestRunner.run(runOptions); - - expect(processEnvMock.NODE_ENV).to.equal('stryker'); - }); - - it('should override verbose, collectCoverage, testResultsProcessor, notify and bail on all loaded configs', async () => { - await jestTestRunner.run(runOptions); - - expect( - jestTestAdapterMock.run.calledWith({ - bail: false, - collectCoverage: false, - notify: false, - testResultsProcessor: undefined, - verbose: false, - }) - ); - }); -}); +// import { RunOptions, RunStatus, TestStatus } from '@stryker-mutator/api/test_runner'; +// import { testInjector } from '@stryker-mutator/test-helpers'; +// import { expect } from 'chai'; +// import sinon from 'sinon'; + +// import { JestTestAdapter } from '../../src/jestTestAdapters'; +// import JestTestRunner from '../../src/JestTestRunner'; +// import * as producers from '../helpers/producers'; +// import { processEnvToken, jestTestAdapterToken, configLoaderToken } from '../../src/pluginTokens'; +// import JestConfigLoader from '../../src/configLoaders/JestConfigLoader'; + +// describe('JestTestRunner', () => { +// const basePath = '/path/to/project/root'; +// const runOptions: RunOptions = { timeout: 0 }; + +// let jestTestAdapterMock: sinon.SinonStubbedInstance; +// let jestConfigLoaderMock: sinon.SinonStubbedInstance; +// let jestTestRunner: JestTestRunner; +// let processEnvMock: NodeJS.ProcessEnv; + +// beforeEach(() => { +// jestTestAdapterMock = { run: sinon.stub() }; +// jestTestAdapterMock.run.resolves({ results: { testResults: [] } }); +// jestConfigLoaderMock = { loadConfig: sinon.stub() }; +// jestConfigLoaderMock.loadConfig.resolves({}); + +// testInjector.options.jest = { config: { property: 'value' } }; +// testInjector.options.basePath = basePath; + +// processEnvMock = { +// NODE_ENV: undefined, +// }; + +// jestTestRunner = testInjector.injector +// .provideValue(processEnvToken, processEnvMock) +// .provideValue(jestTestAdapterToken, (jestTestAdapterMock as unknown) as JestTestAdapter) +// .provideValue(configLoaderToken, jestConfigLoaderMock) +// .injectClass(JestTestRunner); +// }); + +// it('should log the project root when constructing the JestTestRunner', () => { +// expect(testInjector.logger.debug).calledWith(`Project root is ${basePath}`); +// }); + +// it('should call the run function with the provided config and the projectRoot', async () => { +// await jestTestRunner.run(runOptions); + +// expect(jestTestAdapterMock.run).called; +// }); + +// it('should call the jestTestRunner run method and return a correct runResult', async () => { +// jestTestAdapterMock.run.resolves({ results: producers.createSuccessResult() }); + +// const result = await jestTestRunner.run(runOptions); + +// expect(result).to.deep.equal({ +// errorMessages: [], +// status: RunStatus.Complete, +// tests: [ +// { +// failureMessages: [], +// name: 'App renders without crashing', +// status: TestStatus.Success, +// timeSpentMs: 23, +// }, +// ], +// }); +// }); + +// it('should call the jestTestRunner run method and return a skipped runResult', async () => { +// jestTestAdapterMock.run.resolves({ results: producers.createPendingResult() }); + +// const result = await jestTestRunner.run(runOptions); + +// expect(result).to.deep.equal({ +// errorMessages: [], +// status: RunStatus.Complete, +// tests: [ +// { +// failureMessages: [], +// name: 'App renders without crashing', +// status: TestStatus.Skipped, +// timeSpentMs: 0, +// }, +// ], +// }); +// }); + +// it('should call the jestTestRunner run method and return a todo runResult', async () => { +// jestTestAdapterMock.run.resolves({ results: producers.createTodoResult() }); + +// const result = await jestTestRunner.run(runOptions); + +// expect(result).to.deep.equal({ +// errorMessages: [], +// status: RunStatus.Complete, +// tests: [ +// { +// failureMessages: [], +// name: 'App renders without crashing', +// status: TestStatus.Success, +// timeSpentMs: 4, +// }, +// { +// failureMessages: [], +// name: 'App renders without crashing with children', +// status: TestStatus.Skipped, +// timeSpentMs: 0, +// }, +// ], +// }); +// }); + +// it('should call the jestTestRunner run method and return a negative runResult', async () => { +// jestTestAdapterMock.run.resolves({ results: producers.createFailResult() }); + +// const result = await jestTestRunner.run(runOptions); + +// expect(result).to.deep.equal({ +// errorMessages: ['test failed - App.test.js'], +// status: RunStatus.Complete, +// tests: [ +// { +// failureMessages: ['Fail message 1', 'Fail message 2'], +// name: 'App render renders without crashing', +// status: TestStatus.Failed, +// timeSpentMs: 2, +// }, +// { +// failureMessages: ['Fail message 3', 'Fail message 4'], +// name: 'App render renders without crashing', +// status: TestStatus.Failed, +// timeSpentMs: 0, +// }, +// { +// failureMessages: [], +// name: 'App renders without crashing', +// status: TestStatus.Success, +// timeSpentMs: 23, +// }, +// ], +// }); +// }); + +// it('should return an error result when a runtime error occurs', async () => { +// jestTestAdapterMock.run.resolves({ results: { testResults: [], numRuntimeErrorTestSuites: 1 } }); + +// const result = await jestTestRunner.run(runOptions); + +// expect(result).to.deep.equal({ +// errorMessages: [], +// status: RunStatus.Error, +// tests: [], +// }); +// }); + +// it("should set process.env.NODE_ENV to 'test' when process.env.NODE_ENV is null", async () => { +// await jestTestRunner.run(runOptions); + +// expect(processEnvMock.NODE_ENV).to.equal('test'); +// }); + +// it('should keep the value set in process.env.NODE_ENV if not null', async () => { +// processEnvMock.NODE_ENV = 'stryker'; + +// await jestTestRunner.run(runOptions); + +// expect(processEnvMock.NODE_ENV).to.equal('stryker'); +// }); + +// it('should override verbose, collectCoverage, testResultsProcessor, notify and bail on all loaded configs', async () => { +// await jestTestRunner.run(runOptions); + +// expect( +// jestTestAdapterMock.run.calledWith({ +// bail: false, +// collectCoverage: false, +// notify: false, +// testResultsProcessor: undefined, +// verbose: false, +// }) +// ); +// }); +// });