feat(command): Support command test runner with mutation switching #2345
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.