Skip to content

Specify which tests to run in a scalable way #4396

@boujeepossum

Description

@boujeepossum

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions