3 ms·
> In the popular jest test runner, each test file is executed in its own child process. Is that confirmed? I've been following this issue: https://github.com
by Tade0 3y ago
> In the popular jest test runner, each test file is executed in its own child process.
Is that confirmed?
I've been following this issue:
https://github.com/jestjs/jest/issues/6957 https://github.com/jestjs/jest/issues/6957
And what Jest actually does is still kind of muddy.
In contrast to that, other test runners like AVA have a clear description what happens when:
https://github.com/avajs/ava/blob/main/docs/01-writing-tests.md#process-isolation https://github.com/avajs/ava/blob/main/docs/01-writing-tests...
- mhagemeister 3y agoIt's not a secret what jest does. There are a few abstractions to jump through, but I find jest's code very readable overall. By default the `workerThreads` option is set to `false`. Then we reach their `WorkerPool` class which pools the test runs. The "Worker" in the name is not to be confused with WebWorkers or node's worker_threads. It's merely the term the jest team has chosen. Inside that and because workerThreads is set to false, we instantiate a child process here https://github.com/jestjs/jest/blob/00ef0ed0a03764f24ff568bc87dcc1c203d28625/packages/jest-worker/src/WorkerPool.ts#L36 https://github.com/jestjs/jest/blob/00ef0ed0a03764f24ff568bc...
- Tade0 3y agoThis doesn't fully answer my question, because in the issue I linked it's explained that Jest might to decide to implicitly apply `runInBand` when... it feels like apparently, because that's not well documented. I see it as a major design flaw, because I have had mysterious, impossible to debug errors happen due to this in just about every project that used Jest that I've been in.