Alex Latchford
Alex Latchford

Reputation: 655

Running subsets of Jest tests in parallel

We're using Jest to power our Node.js tests, these interact with a Postgres database to test CRUD operations. We're currently passing the --runInBand CLI option to ensure our tests operate in serial, this works fine but is obviously slower than we'd like.

Now from reading around (and previous experience) I've found it useful to be able to mark groups of tests as parallelise-able. This is possible with nose in python but I cannot seem to find the syntax in Jest. Is this possible? Or is there another approach to speeding up database (or state constrained to generalise) tests that Jest advocates?

Thanks, Alex

Upvotes: 6

Views: 3122

Answers (1)

trusktr
trusktr

Reputation: 45494

Put your tests in separate files (in a new sub folder if you want to keep them organized). That way Jest runs the files in parallel.

Upvotes: 1

Related Questions