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

Coverage analysis based on mutants instead of code coverage #2104

Closed
nicojs opened this issue Mar 13, 2020 · 2 comments
Closed

Coverage analysis based on mutants instead of code coverage #2104

nicojs opened this issue Mar 13, 2020 · 2 comments
Labels
🚀 Feature request New feature request

Comments

@nicojs
Copy link
Member

nicojs commented Mar 13, 2020

Our coverage analysis is a brilliant feat of engineering (if I do say so myself). This is how it works:

  • It will use instanbul to instrument files to be mutated
  • It will inject a piece of code to run before each test to extract the current coverage results so we know the coverage per test
  • It will communicate the coverage per test between the test runner (browser or separate node process)
    • Some lossless compression is involved in order to not overload and crash.

However, this has a lot of downsides:

  • Files are instrumented by Istanbul, which only supports JavaScript. So in order to support TypeScript we had to support sourcemaps. Which is a somewhat expensive part of the code to maintain.
  • It will only work for transpiled languages if it is transpiled using the typescript transpiler plugin. We could add support for other transpiler plugins, however, most users working with transpiled languages do not use the transpiler plugins. Instead, they rely on their test runner to do the transpiling (for example using ng test, karma-webpack or jest) or by require hooks (ts-node, @babel/register).

Solution

In order to add support for more use cases in a maintainable way, we should implement our own "mutant coverage instrumentation" in the source code (copy) itself.

With the unification on one mutator infrastructure in #1893, we should make sure to also align on 1 AST (preferably babel or estree. Furthermore, we should make sure that the new Mutator API will communicate mutants based on their AST nodes. Stryker would then be able to transform the AST in order to instrument for mutation coverage.

@nicojs nicojs added the 🚀 Feature request New feature request label Mar 13, 2020
@nicojs
Copy link
Member Author

nicojs commented Apr 24, 2020

Should be fixed when we implement mutation switching #1514

@nicojs
Copy link
Member Author

nicojs commented Oct 18, 2020

Implemented in Stryker 4

@nicojs nicojs closed this as completed Oct 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 Feature request New feature request
Projects
None yet
Development

No branches or pull requests

1 participant