Skip to content

Workers in parallel worker pool should have JEST_WORKER_ID assigned in ENV #2284

@evantahler

Description

@evantahler

Hi!

Jest is cool. Thank you for all your hard work! I'm porting ActionHero's test suite to Jest, as some of the features you have (--watch, parallel execution, etc) make testing much better.

ActionHero is a server-side node.js project, and many of our tests rely on interacting with a database (Redis for us). To fully isolate our tests, we need to boot the server on unique ports and have separate databases for each test to work against. This allows tests to run in parallel and not pollute each other.

We can try to derive a unique ID for each worker in the pool via the PID, IE: let id = process.pid % require('os').cpus().length, but you sill may end up with collisions.

If each test-running worker was assigned a unique ID from the parent like process.env.JEST_WORKER_ID = 1, that would make this possible

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions