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

Running Jest with --findRelatedTests #1226

Closed
RobertBroersma opened this issue Nov 2, 2018 · 4 comments
Closed

Running Jest with --findRelatedTests #1226

RobertBroersma opened this issue Nov 2, 2018 · 4 comments

Comments

@RobertBroersma
Copy link
Contributor

When running Stryker with Jest, it runs your entire test suite for every mutation. If you have a large test suite this can take quite some time.

Jest has an awesome flag called --findRelatedTests, which finds tests related to the file you pass as an arguments. E.g. jest --findRelatedTests index.js would only run the tests related to index.js. (Often used with lint-staged.

If it would be possible to pass the current mutation to the Test Runner, this would save a ton of time!

@simondel
Copy link
Member

simondel commented Nov 4, 2018

@nicojs What are your thoughts on this compared to doing code coverage analysis? To use this feature, we'll need to let the testrunner know which file contains a mutant.

@nicojs
Copy link
Member

nicojs commented Nov 4, 2018

Hmm sounds like a fairly straightforward solution that could speed things up for jest users. We would have to make sure we add integration tests for it. Also: we might need to add it as a confirmation option, as it might result in unexpected behavior, right?

This is the documentation for the feature: https://jestjs.io/docs/en/cli#findrelatedtests-spaceseparatedlistofsourcefiles

@RobertBroersma thanks for reporting this. Do you want to take a shot at it?

@RobertBroersma
Copy link
Contributor Author

@nicojs I suppose the option could be added to the config file, perhaps even supporting the --bail flag, which stops jest as soon as a test fails (mutant killed, why kill it again).

I would like to have a crack at it, but I'd need to see if I can get some company time allocated to this, otherwise do it in my spare time. If you could give me some pointers on where to start that would be great!

@RobertBroersma
Copy link
Contributor Author

PR Opened #1235

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants