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

Error during loading "stryker-jest-runner" plugin #354

Closed
Fenntasy opened this issue Aug 10, 2017 · 2 comments
Closed

Error during loading "stryker-jest-runner" plugin #354

Fenntasy opened this issue Aug 10, 2017 · 2 comments

Comments

@Fenntasy
Copy link

Hi, I don't know how to make it work with a simple test (a greet function) with jest.

I created a repo with my error mutant-testing if you want to test it. Jest works, I tried to apply the tip given by the error to reinstall the jest-runner to no avail. I also tried with node 6.10.0 and npm 3.10.10 to be sure that it was not an effect of a too recent version.

Here is the error I get

❯ npm run stryker

> mutant-testing@1.0.0 stryker /Users/fenn/Workspace/fewlines/tests-sparta/mutant-testing
> stryker run stryker.conf.js

[2017-08-10 18:02:18.873] [WARN] PluginLoader - Error during loading "stryker-jest-runner" plugin:
  Cannot find module 'jest-cli/build/runTest'
[2017-08-10 18:02:18.889] [INFO] InputFileResolver - Found 1 of 2 file(s) to be mutated.
[2017-08-10 18:02:18.890] [INFO] SandboxCoordinator - Starting initial test run. This may take a while.
[2017-08-10 18:02:19.173] [ERROR] IsolatedTestRunnerAdapter - /Users/fenn/Workspace/fewlines/tests-sparta/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 (/Users/fenn/Workspace/fewlines/tests-sparta/mutant-testing/node_modules/stryker-api/src/core/Factory.js:43:19)
    at IsolatedTestRunnerAdapterWorker.start (/Users/fenn/Workspace/fewlines/tests-sparta/mutant-testing/node_modules/stryker/src/isolated-runner/IsolatedTestRunnerAdapterWorker.js:42:80)
    at process.<anonymous> (/Users/fenn/Workspace/fewlines/tests-sparta/mutant-testing/node_modules/stryker/src/isolated-runner/IsolatedTestRunnerAdapterWorker.js:19:27)
    at emitTwo (events.js:106:13)
    at process.emit (events.js:191:7)
    at process.nextTick (internal/child_process.js:744:12)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

[2017-08-10 18:02:19.178] [ERROR] IsolatedTestRunnerAdapter - Child process exited with non-zero exit code 1. Last 10 message from the child process were:
	[2017-08-10 18:02:19.068] [DEBUG] PluginLoader - Loading stryker-* from /Users/fenn/Workspace/fewlines/tests-sparta/mutant-testing/node_modules

	[2017-08-10 18:02:19.073] [DEBUG] PluginLoader - Loading plugins stryker-jasmine (matched with expression stryker-*)

	[2017-08-10 18:02:19.074] [DEBUG] PluginLoader - Loading plugins stryker-jest-runner (matched with expression stryker-*)

	[2017-08-10 18:02:19.074] [DEBUG] PluginLoader - Loading plugins stryker-jasmine

	[2017-08-10 18:02:19.075] [DEBUG] PluginLoader - Loading plugins stryker-jest-runner

	[2017-08-10 18:02:19.171] [WARN] PluginLoader - Error during loading "stryker-jest-runner" plugin:
  Cannot find module 'jest-cli/build/runTest'

	[2017-08-10 18:02:19.171] [DEBUG] IsolatedTestRunnerAdapterWorker - Changing current working directory for this process to /Users/fenn/Workspace/fewlines/tests-sparta/mutant-testing/.stryker-tmp/3908955/sandbox8813052

[2017-08-10 18:02:19.179] [ERROR] stryker-cli - an error occurred Test runner child process exited with non-zero exit code 1

Could you point me to the right direction?

@nicojs
Copy link
Member

nicojs commented Aug 10, 2017

Hi Fenntasy, thanks for trying out Stryker.

It seems that the stryker-jest-runner has troubles loading:

[2017-08-10 18:22:49.581] [WARN] PluginLoader - Error during loading "stryker-jest-runner" plugin:
  Cannot find module 'jest-cli/build/runTest'

After installing jest-cli npm i jest-cli i got this error:

[2017-08-10 18:49:26.685] [ERROR] IsolatedTestRunnerAdapter - (node:17004) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Runtime.createHasteContext is not a function

Apparently, stryker-jest-runner does not support the current version of jest. I've created issue#15 for this. @mthmulders could you take a look at this?

Downgrading to jest@18 works:

npm i jest@18 jest-cli@18
npm run stryker

[2017-08-10 18:46:57.769] [INFO] ConfigReader - Using stryker.conf.js in the current working directory.
[2017-08-10 18:46:57.893] [INFO] InputFileResolver - Found 1 of 2 file(s) to be mutated.
[2017-08-10 18:46:57.894] [INFO] SandboxCoordinator - Starting initial test run. This may take a while.
[2017-08-10 18:46:59.271] [INFO] Stryker - Initial test run succeeded. Ran 1 tests in 1 second.
[2017-08-10 18:46:59.280] [INFO] Stryker - 1 Mutant(s) generated
[2017-08-10 18:46:59.281] [WARN] MutantTestMatcher - No coverage result found, even though coverageAnalysis is "perTest". Assuming that all tests cover each mutant. This might have a big impact on the performance.
[2017-08-10 18:46:59.286] [INFO] SandboxCoordinator - Creating 8 test runners (based on CPU count)
Mutation testing  [] 100% (ETC 0.0s)[1 killed] [0 survived] [0 no coverage] [0 timeout] [0 error]

Ran 1.00 tests per mutant on average.
----------|---------|----------|-----------|------------|----------|---------|
File      | % score | # killed | # timeout | # survived | # no cov | # error |
----------|---------|----------|-----------|------------|----------|---------|
All files |  100.00 |        1 |         0 |          0 |        0 |       0 |
----------|---------|----------|-----------|------------|----------|---------|
[2017-08-10 18:47:01.662] [INFO] Stryker - Done in 3 seconds.

@Fenntasy
Copy link
Author

Thank you for the input, apparently downgrading to Jest 19 also works.

As the problem lies with the runner, I'm closing the issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants