Stryker: How to execute a custom command for running tests instead of npm run test ?

Created on 2 Oct 2020  ยท  4Comments  ยท  Source: stryker-mutator/stryker

Question

Hello ๐Ÿ‘‹

First, thank you for this great library ๐Ÿ™

After reading the documentation, I didn't find a way to execute a custom command to run tests ๐Ÿ˜• Basically when I run :
npx stryker run it uses npm test under the hood for running tests.

How can I customize the command to execute for running tests ?

For example let's say I want to ignore my integration tests, and want to run mutation testing only for unit tests, in this case I would like to execute the command npm run jest src/**/__unit_tests__/*.spec.ts

Thanks !

Stryker environment

"@stryker-mutator/core": "3.3.1",
"@stryker-mutator/jest-runner": "3.3.1",
"@stryker-mutator/typescript": "3.3.1",
"jest": "26.4.2",
"ts-jest": "26.4.1",

Additional context

๐Ÿ› Bug ๐Ÿ‘ถ Good first issue

All 4 comments

You can use

{
  "commandRunner": {
    "command": "jest src/**/__unit_tests__/*.spec.ts"
  }
}

I guess it is not yet documented. Sorry for that.

Thanks for the answer @nicojs , it works perfectly ๐Ÿ‘Œ If you want I can create a PR to update the documentation ๐Ÿ˜„
Probably here https://github.com/stryker-mutator/stryker/blob/master/packages/core/README.md#configuration ?

Yes!!! Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davesag picture davesag  ยท  17Comments

trollepierre picture trollepierre  ยท  18Comments

kmdrGroch picture kmdrGroch  ยท  19Comments

simondel picture simondel  ยท  17Comments

nicojs picture nicojs  ยท  17Comments