stryker-mutator / stryker-js

Mutation testing for JavaScript and friends
https://stryker-mutator.io
Apache License 2.0
2.55k stars 242 forks source link

Instrument run only #4790

Closed jaspervdveen closed 3 months ago

jaspervdveen commented 3 months ago

Is your feature request related to a problem? Please describe. For #4779, I would like to show mutations in the Test Explorer which haven't been tested yet (pending mutations). As a developer, you can then pick which specific subsets of mutations you would like to test, as well as showing annotations in the code editor at the mutation locations, without first having to wait for a completed mutation test run.

Describe the solution you'd like To support this feature, I would like to implement an instrumentationRunOnly option (comparable idea to dryRunOnly) and add a new reporter event, so mutations can be reported to the extension without actual mutation testing or a dry run being executed, as both processes can take a long time, especially in larger projects. Loading available mutations into the Test Explorer should be relatively fast, as it needs to run when loading the workspace, on code changes etc.

My idea is, with this option, to stop the Stryker flow in MutantInstrumentExecutor directly after instrumenting the mutations, as well as creating a new onInstrumentationRunCompleted reporter event with placed mutations as the payload. In the JSON-reporter, I would like to listen to this event and report the result to a JSON-file if the option instrumentRunOnly is set to true (or make this optional via the jsonReporter config?). Then, it would be possible to load the mutations into the Test Explorer.

Additional context I'm interested in your thoughts on this proposal.