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

feat(command): Support command test runner with mutation switching #2345

Conversation

nicojs
Copy link
Member

@nicojs nicojs commented Aug 3, 2020

Add support for the command test runner with mutation switching.

NOTE: Support for the command test runner is "best effort"! It might not work for your test runner of choice

The switching of mutants is done by providing the __STRYKER_ACTIVE_MUTANT__ environment variable when executing the command. The @stryker-mutator/instrumenter now adds a check for this environment variable in each source file. This only works if the command you configure allows for this environment variable to flow through to the test environment.

In other words: this should work for node test runners like node-tap and mocha but not for test runners that spin up their own test environment, like jest or karma.

Note that for mocha, karma, and jest, you're better of using their respective test runner plugins.

Add support for the command test runner with mutation switching.

_NOTE: Support for the command test runner is best effort!_. It might not work for your test runner of choice.

Switching of mutants is done by providing the __STRYKER_ACTIVE_MUTANT__ environment variable when executing the command. The `@stryker-mutator/instrumenter` now adds a check for this environment variable in each source file. This only works if the command you configure allows for this environment variable to flow through to the test environment.

In other words: this should work for node test runners like [node-tap](https://node-tap.org/) and mocha but not for test runners that spin up their own test environment, like jest or karma.

Note that for mocha, karma and jest, you're better of using their respective test runner plugins.
@nicojs nicojs merged commit 59b1cfc into epic/mutation-switching Aug 3, 2020
@nicojs nicojs deleted the feat/command-test-runner-with-mutation-switching branch August 3, 2020 21:30
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

Successfully merging this pull request may close these issues.

None yet

1 participant