test_runner: support running tests in process
Opening as a draft. Some of this logic is from https://github.com/nodejs/node/pull/53921. I also still need to finish docs and tests. I've added @MoLow as a co-author because the work in https://github.com/nodejs/node/pull/51579 was very helpful.
This commit introduces a new --experimental-test-isolation
flag that, when set to 'none'
, causes the test runner to execute all tests in the same process. By default, this is the main test runner process, but if watch mode is enabled, it spawns a separate process that runs all of the tests.
The default value of the new flag is 'process'
, which uses the existing behavior of running each test file in its own child process.
It is worth noting that when the isolation mode is 'none'
, globals and all other top level logic (such as top level hooks) is shared among all files.