stryker-mutator / stryker-jest-runner

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stryker-jest-runner unable to run

ckjeldgaard opened this issue · comments

Hi, I was trying out Stryker on a project using jest and stumpled upon an error when trying to run Stryker with the newest dependency versions. It looks similar to the one reported in issue #354 in stryker and fixed in version 0.1.0 of the stryker-jest-runner plugin.
I have reproduced the error in a mutant-testing repo forked from the example project in issue #15. The dependency versions in package.json are updated to:

"devDependencies": {
  "babel-jest": "^21.2.0",
  "babel-preset-env": "^1.6.0",
  "jest": "^21.2.1",
  "jest-cli": "^21.2.1",
  "regenerator-runtime": "^0.11.0",
  "stryker": "^0.13.0",
  "stryker-api": "^0.11.0",
  "stryker-jest-runner": "^0.2.2"
}

Running Stryker then fails with the following output:

$ npm run stryker

> mutant-testing@1.0.0 stryker /home/ckp/mutant-testing
> stryker run stryker.conf.js

[2017-10-31 16:01:53.920] [WARN] PluginLoader - Error during loading "stryker-jest-runner" plugin:
  Cannot find module 'jest-cli/build/runTest'
[2017-10-31 16:01:53.924] [INFO] ReporterOrchestrator - Detected that current console does not support the "progress" reporter, downgrading to "progress-append-only" reporter
[2017-10-31 16:01:53.938] [INFO] InputFileResolver - Found 1 of 2 file(s) to be mutated.
[2017-10-31 16:01:53.939] [INFO] InitialTestExecutor - Starting initial test run. This may take a while.
[2017-10-31 16:01:54.090] [ERROR] TestRunnerChildProcessAdapter - /home/ckp/mutant-testing/node_modules/stryker-api/src/core/Factory.js:43
            throw new Error("Could not find a " + this.factoryName + " with name " + name + ", did you install it correctly (for example: npm install --save-dev " + this.importSuggestion(name) + ")?");
            ^

Error: Could not find a testrunner with name jest, did you install it correctly (for example: npm install --save-dev stryker-jest-runner)?
    at TestRunnerFactory.Factory.create (/home/ckp/mutant-testing/node_modules/stryker-api/src/core/Factory.js:43:19)
    at IsolatedTestRunnerAdapterWorker.start (/home/ckp/mutant-testing/node_modules/stryker/src/isolated-runner/IsolatedTestRunnerAdapterWorker.js:60:80)
    at process.<anonymous> (/home/ckp/mutant-testing/node_modules/stryker/src/isolated-runner/IsolatedTestRunnerAdapterWorker.js:20:27)
    at emitTwo (events.js:106:13)
    at process.emit (events.js:191:7)
    at process.nextTick (internal/child_process.js:787:12)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

[2017-10-31 16:01:54.094] [ERROR] TestRunnerChildProcessAdapter - Child process exited with non-zero exit code 1. Last 10 message from the child process were: 
	[2017-10-31 16:01:54.081] [DEBUG] PluginLoader - Loading stryker-* from /home/ckp/mutant-testing/node_modules
	[2017-10-31 16:01:54.086] [DEBUG] PluginLoader - Loading plugins stryker-jest-runner (matched with expression stryker-*)
	[2017-10-31 16:01:54.086] [DEBUG] PluginLoader - Loading plugins stryker-jest-runner
	[2017-10-31 16:01:54.088] [WARN] PluginLoader - Error during loading "stryker-jest-runner" plugin:
  Cannot find module 'jest-cli/build/runTest'
	[2017-10-31 16:01:54.088] [DEBUG] IsolatedTestRunnerAdapterWorker - Changing current working directory for this process to /home/ckp/mutant-testing/.stryker-tmp/sandbox9923194
[2017-10-31 16:01:54.095] [ERROR] StrykerCli - an error occurred Test runner child process exited with non-zero exit code 1

My reason for updating all the dependencies was to try out mutation testing of Typescript code in the latest 0.10.0 version of Stryker.
Any ideas what could be wrong?

Hi Christoffer, thanks for the detailed report. I'm having some rather busy weeks, but will try to take a look in a few days. Thanks for your understanding.

Thanks again for the report. In your package.json I see Jest and Jest CLI 21.2.1. I haven't tested Stryker with this version yet, and it seems that downgrading to 20.0.4 seems to make things work again.

In the meantime, I'll see if I can add support for 21. Stay tuned...

Wow. Issue 21 is about the support for Jest v21? I love how the universe works sometimes 🌝

You are right, @mthmulders. Downgrading to Jest 20.0.4 works with version 0.2.2 of stryker-jest-runner. Looking forward to the Jest v21 support. Thanks.

I've just published v0.3.0. It should work with Jest 21. Enjoy!