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

Specify which tests to run in a scalable way #4396

Closed
aaronabramov opened this issue Aug 30, 2017 · 5 comments
Closed

Specify which tests to run in a scalable way #4396

aaronabramov opened this issue Aug 30, 2017 · 5 comments
Assignees

Comments

@aaronabramov
Copy link
Contributor

aaronabramov commented Aug 30, 2017

I hit a performance problem trying to run to many tests.

I call jest with jest test1.js test2.js test3.js ... test9999.js
which eventually gets transformed into a regexp by
https://github.com/facebook/jest/blob/master/packages/jest-config/src/normalize.js#L289

and used to match agains every test file to figure out whether we want to run it or not.

It works on small runs, but when i send a few thousand test paths it slows down the process a lot.

The solution i'm thinking about is to have a --runTestPaths flag that will tell jest not to use regexp matching logic to find tests, but rather match by relative patch.

if (config.runTestPaths) {
  const testsToRun = new Set(argv._);
}

// later in the code
const testsToRun = allTests.filter(testPath => testsToRun.has(testPath);

@mjesun

@cpojer
Copy link
Member

cpojer commented Aug 31, 2017

Could we instead run all the tests? If it's a few thousand test files, that seems like it captures most tests.

I'm a bit worried about adding yet another config option to control running of tests, the CLI is becoming a bit of a mess :(

@mjesun
Copy link
Contributor

mjesun commented Aug 31, 2017

The issue happens when you have a filtered list of tests that is a subset of all tests.

@aaronabramov
Copy link
Contributor Author

@cpojer i agree about CLI becoming a mess, but we really need this :(
this is not an --all scenario.
If you touch a critical file (for example flux_dispatcher.js) that used in many files in a particular project (for example Ads) it will try to run most of Ads tests (not all of www, just ads, which is still a lot), and then filter out the tests that are known as flaky or failing.
So we can't run all with excluded tests either here :(

@cpojer
Copy link
Member

cpojer commented Aug 31, 2017

--runTestsByPath, then, maybe?

@mjesun mjesun changed the title specify which tests to run in a scalable way Specify which tests to run in a scalable way Sep 1, 2017
@cpojer cpojer closed this as completed in 2c910dc Sep 5, 2017
tabrindle pushed a commit to tabrindle/jest that referenced this issue Oct 2, 2017
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants