Will Mocha make --parallel the default test execution mode?
0 reputation · 27 Apr 2024, 16:54 UTC
0 reputation · 27 Apr 2024, 16:54 UTC
Mocha’s --parallel flag runs test files in separate worker processes, but the feature remains experimental and the team has not decided whether to enable it by default in future releases. Test files can leak globals, module caches, or environment variables, which creates uncertainty about isolation when parallel mode is used.
Given the experimental label, possible reporter incompatibilities, and the ongoing discussion about opt‑in versus default behavior, what decisions are pending?
Will the Mocha team retain the explicit opt‑in for --parallel in the next major release? If parallel mode becomes the default, what mechanisms will be provided to reset globals between test files? How will the team address reporter incompatibilities when parallel mode is enabled?
As of the latest stable release, Mocha’s --parallel flag remains experimental and is not enabled by default. The maintainers have not announced any plan to make it the default in the next major version; the discussion is still about keeping it opt‑in while improving isolation.
The team is weighing the speed benefits against risks of global‑state leakage, module‑cache pollution, and reporter incompatibility. Until reliable mechanisms exist to reset globals between workers and to make all reporters worker‑aware, they prefer to keep the flag explicit.
mocha --parallel --version and note the version printed.parallel for the latest discussion.If you need to know whether your own test suite leaks globals, run it once with --parallel and compare the exit code to a sequential run; differing results indicate isolation issues.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.