Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Jest] crash on Jest 25 #2031

Closed
brodycj opened this issue Feb 12, 2020 · 2 comments
Closed

[Jest] crash on Jest 25 #2031

brodycj opened this issue Feb 12, 2020 · 2 comments
Labels
🐛 Bug Something isn't working

Comments

@brodycj
Copy link

brodycj commented Feb 12, 2020

Summary

I tried upgrading my own package to use Jest 25 in brodycj/create-react-native-module#240, now the Jest runner crashes. Quick fix workaround for Jest 25 is to use default command runner, with testing time more than doubled for me.

I think this issue is caused by the way Jest 25 changed how it exports its CLI function.

I would personally favor that we make a new major release of the Stryker Jest runner that works with Jest 25 and drop support for any older versions of Jest that would not be compatible.

Here is my output if I try with latest update of Stryker, with HTML reporter removed:

% npx stryker run
12:14:18 (92133) INFO ConfigReader Using stryker.conf.js in the current working directory.
12:14:18 (92133) INFO InputFileResolver Found 10 of 104 file(s) to be mutated.
12:14:18 (92133) INFO InitialTestExecutor Starting initial test run. This may take a while.
12:14:22 (92133) ERROR InitialTestExecutor One or more tests resulted in an error:
	Test runner crashed. Tried twice to restart it without any luck. Last time the error message was: Error: TypeError: Cannot read property 'runCLI' of undefined
TypeError: Cannot read property 'runCLI' of undefined
    at JestPromiseTestAdapter.run (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/jest-runner/src/jestTestAdapters/JestPromiseTestAdapter.js:17:31)
    at JestTestRunner.run (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/jest-runner/src/JestTestRunner.js:43:56)
    at ChildProcessTestRunnerWorker.run (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/core/src/test-runner/ChildProcessTestRunnerWorker.js:24:56)
    at ChildProcessProxyWorker.doCall (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/core/src/child-proxy/ChildProcessProxyWorker.js:75:56)
    at Promise.then.send.correlationId (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/core/src/child-proxy/ChildProcessProxyWorker.js:46:53)
    at new Promise (<anonymous>)
    at ChildProcessProxyWorker.handleMessage (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/core/src/child-proxy/ChildProcessProxyWorker.js:46:17)
    at process.emit (events.js:223:5)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
Error: TypeError: Cannot read property 'runCLI' of undefined
TypeError: Cannot read property 'runCLI' of undefined
    at JestPromiseTestAdapter.run (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/jest-runner/src/jestTestAdapters/JestPromiseTestAdapter.js:17:31)
    at JestTestRunner.run (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/jest-runner/src/JestTestRunner.js:43:56)
    at ChildProcessTestRunnerWorker.run (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/core/src/test-runner/ChildProcessTestRunnerWorker.js:24:56)
    at ChildProcessProxyWorker.doCall (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/core/src/child-proxy/ChildProcessProxyWorker.js:75:56)
    at Promise.then.send.correlationId (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/core/src/child-proxy/ChildProcessProxyWorker.js:46:53)
    at new Promise (<anonymous>)
    at ChildProcessProxyWorker.handleMessage (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/core/src/child-proxy/ChildProcessProxyWorker.js:46:17)
    at process.emit (events.js:223:5)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
    at ChildProcess.<anonymous> (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/core/src/child-proxy/ChildProcessProxy.js:133:68)
    at ChildProcess.emit (events.js:223:5)
    at emit (internal/child_process.js:876:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
12:14:22 (92133) ERROR StrykerCli an error occurred Error: Something went wrong in the initial test run
    at InitialTestExecutor.validateResult (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/core/src/process/InitialTestExecutor.js:86:15)
    at InitialTestExecutor.run (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/core/src/process/InitialTestExecutor.js:41:14)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
    at async Stryker.runMutationTest (/Users/brodybits/dev/create-react-native-module/node_modules/@stryker-mutator/core/src/Stryker.js:54:38)
12:14:22 (92133) INFO StrykerCli Trouble figuring out what went wrong? Try `npx stryker run --fileLogLevel trace --logLevel debug` to get some more info.

Stryker config

With HTML reporter removed:

module.exports = config => {
  config.set({
    mutator: 'javascript',
    mutate: ['lib/**/*.js', 'templates/**/*.js'],
    packageManager: 'yarn',
    reporters: ['clear-text', 'progress'],
    testRunner: 'jest',
    transpilers: [],
    coverageAnalysis: 'off'
  });
};

Test runner config

none

Stryker environment

├─┬ @stryker-mutator/core@2.5.0
│ ├─┬ @stryker-mutator/api@2.5.0
│ ├── @stryker-mutator/util@2.5.0
├─┬ @stryker-mutator/javascript-mutator@2.5.0
│ ├── @stryker-mutator/api@2.5.0 deduped
├─┬ @stryker-mutator/jest-runner@2.5.0
│ ├── @stryker-mutator/api@2.5.0 deduped

partial:

─┬ @stryker-mutator/jest-runner@2.5.0
[...]
├─┬ jest@25.1.0
[...]
│ ├─┬ @jest/core@25.1.0
[...]
 └─┬ jest-cli@25.1.0
[...]

Test runner environment

from package.json:

    "test": "npm run lint && npm run jest"

Your Environment

software version(s)
node v12.15.0
npm 6.13.7
Operating System macOS version 10.15.2 (19C57)

Add stryker.log

stryker.log

@brodycj brodycj added the 🐛 Bug Something isn't working label Feb 12, 2020
@simondel
Copy link
Member

Thanks for opening this issue! It seems like you have the same issue as #1983 so I'm closing this one for now.

@simondel
Copy link
Member

Hi! Jest 25 support has been released with @stryker-mutator version 3! You can read all about it here: https://stryker-mutator.io/blog/2020-03-11/stryker-version-3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants