You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of using Workers, use cluster module ir child_process. This way, they would be full y independent processes so they would not share global atte, the same way Jest default environment does, and Aldo native chdir can be used.
The text was updated successfully, but these errors were encountered:
Workers don't share global state between each other.
Jest gets test isolation by running every test in a new "vm context", using the vm Node.js module. The purpose of this runner is to avoid dong that, which means that we cannot have tests isolation.
(technically, we could spawn a new worker/process for every test: however, that would make the runner painfully slower, probably orders of magnitude slower than the default Jest runner).
(technically, we could spawn a new worker/process for every test: however, that would make the runner painfully slower, probably orders of magnitude slower than the default Jest runner).
How about spawning a new worker process per test file? It would give us partial isolation - the global state is shared by all tests in a single file but not between different test files. The downside is the slightly more complex mental model - a change in the global state affects some tests but not all.
Instead of using Workers, use cluster module ir child_process. This way, they would be full y independent processes so they would not share global atte, the same way Jest default environment does, and Aldo native chdir can be used.
The text was updated successfully, but these errors were encountered: