-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support concurrency
when --experimental-test-isolation
is set to 'none'
#55939
Comments
This wouldn't make sense. A "worker" here is a child process. When isolation=none, there are no child processes and everything runs in the same process.
That flag essentially does isolation=process. Also note all of the caveats that come with that flag in Mocha. I think you are essentially conflating parallelism of the CLI (the concurrency and isolation flags) with parallelism within a single file. There is no CLI flag to set concurrency within a single file, but there are APIs such as the |
Hi @cjihrig ! Thanks for the quick reply... I work with @blimmer 👋, so can chime in on our use case... We understand Stepping back, what we're after is running ~8 test files simultaneously (across a suite of ~1000s of test files), but without each test file getting its own dedicated short-lived child process. I.e. we'd be fine with ~8 child processes, as long as those child processes were long-lived, and did not have any "isolation" (aka new process) between each test files. What we're facing with "1 test file => 1 short-lived process" (isolation) is that each test file has to pay a "require the We want to "require the Afaiu this is what Mocha's concurrency flag does--you're right, it boots up multiple child process (so we get concurrency), but that doesn't mean each test file gets it's own child process (which means isolation). |
Fwiw I think we'd be fine with "all tests run in the main process" (isolation=none), as long as, out of our ~1000s of test files, there are ~5-10 test files running "at the same time". Because our tests make I/O calls to a database Our assumption was that
|
Thanks for explaining. So this is a feature request for one or both of these things:
|
@cjihrig yep, that's right! |
What is the problem this feature will solve?
It would be nice to be able to run multiple "workers" when using the
none
test isolation mode.Today, according to the docs, when
--experimental-test-isolation
is set to'none'
, it implies 1 concurrency:node/doc/api/cli.md
Lines 2252 to 2264 in f270462
However,
mocha
another test runner that does not isolate tests, does accept a concurrency flag: https://mochajs.org/#parallel-testsWhat is the feature you are proposing to solve the problem?
We're looking to move off of
jest
because its test module isolation is extremely slow. We love the idea of using the node-native test runner with isolation disabled, instead of adopting another third-party framework likemocha
.However, we'd need to write some custom code (e.g., using
parallel
) to spin upn
concurrent, isolation-disabled tests to effectively utilize all the cores available on our CI machine.The docs and other recent comments all indicate that when
--experimental-test-isolation
is set to'none'
, concurrency must be1
. However, I couldn't find the reasoning in the original PR or issue.There's probably a good reason for this but, as someone not intimately familiar with the implementation, it's not obvious to me why we wouldn't be able to run non-isolated tests concurrently, like in
mocha
.What alternatives have you considered?
I could probably use a tool like
parallel
to spin up multiple calls tonode --test
. However, this would require me to also write code to split up all the test files between the parallel runs, etc.The text was updated successfully, but these errors were encountered: