Use git to select files

Published: 4 April 2018

The 0.21 release of Stryker simplifies configuration by using your git database.

For a change log per package:

Sandboxes

Stryker only works on copies of your source code. A copy is called a sandbox. It creates as much of them as you want parallel test runners. You don't want a big sandbox. Just imagine what would happen if all your node_modules end up in there! That's why Stryker allows you to configure the files to load into it.

One of the most common issues in our issue tracker has to do with the way you needed to configure it using the files configuration. It was very confusing. The fact that stryker-karma-runner (pre 0.13) and stryker-typescript (pre 0.10) modified your files array (without you knowing it) only added to the complexity. Just a small look at the angular example file will leave you scratching your head.

Further more, you had properties like included, transpiled and mutated. It was kind of a mess really.

Remove your files configuration

No longer! From release 0.21 of Stryker, the files array is optional. Please remove it. Everything should work as expected. Stryker will fallback to a sane default: your git database. It does this by executing the following command: git ls-files --others --exclude-standard --cached. The result should be exactly what you want in your sandbox (given you're using .gitignore files like a boss). If you want to deviate from this for whatever reason, you can still use the files property with an array of strings.

Stryker also stopped keeping track of included, transpiled and mutated properties. For mutate please use the designated mutate top level stryker property.

Breaking change!

Unfortunately we couldn't create this feature without some breaking changes. The biggest one is that we've had to remove the old InputFileDescriptor object way of defining your input file.

This:

// DEPRECATED
files: [ { pattern: 'pattern', included: true, mutated: true, transpiled: true } ]

Is deprecated. If you are using it we strongly suggest to try to remove files entirely.

We've had to update the API to test runner plugins and transpiler plugins as well. Before, Stryker was keeping track of which file needed to be included in the test runner or transpiled by the transpiler. This is no longer the case. To see what this means for you, please consult the readme of the plugins you are using:

What's next?

With this major refactoring out of the way we will hone in to our next target: an actual v1 release. We've opened up issue 654 to keep track of our progress on this front. Want to help? Or curious about our plans? Please get in touch.

Want to get in touch? Find us on Gitter or Twitter.

Back to blogs
Need help?