-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
Add support for running all tests serially #49487
Comments
we have had some pushback on adding more cli flags for the test runner but besides that implementation would be trivial. |
I think most applications would need this as it's a very common case. Environment variables are also good to configure this. Alternatively, we are forcing users to call |
I'm in favor of supporting this use case. I think the biggest questions to answer are:
|
So, if we pass the The proposal is to suppress this and use the integer value passed to I can work on it, please guide. |
I think if nothing is specified, it keeps the current behavior. Otherwise, a number is specified, setting concurrency to X. |
Sure. Thanks |
this is the way its working. So, if we are passing the concurrency option as a number, it will use it. So, what changes we are proposing here? |
Add a cli flag to set the concurrency of |
Ugly solution I have so far in import { tap } from 'node:test/reporters';
import process from 'node:process';
import { run } from 'node:test';
import fs from 'fs';
import path from 'path';
let Files: string[] = [];
function ThroughDirectory(Directory: string) {
fs.readdirSync(Directory).forEach(File => {
const Absolute = path.join(Directory, File);
if (fs.statSync(Absolute).isDirectory()) return ThroughDirectory(Absolute);
else if (Absolute.endsWith('.test.js')) return Files.push(Absolute);
});
}
ThroughDirectory('./dist/test');
// console.log('Files: ' + JSON.stringify(Files));
run({ concurrency: 1, files: Files })
.compose(tap)
.pipe(process.stdout); In Would be good if I could output in spec format as a stream and get the files names/respect the |
This commit adds a new --test-concurrency CLI flag that controls the parallelism of the test runner CLI. Fixes: nodejs#49487
Proposed fix in #49996. I decided to address the concurrency of the CLI only. If we want to provide a mechanism for controlling the concurrency within a test file there are at least a few ways to extend what I've implemented:
The concurrency within individual files is not a priority for me at this time though. |
This commit adds a new --test-concurrency CLI flag that controls the parallelism of the test runner CLI. Fixes: nodejs#49487
|
This commit adds a new --test-concurrency CLI flag that controls the parallelism of the test runner CLI. Fixes: nodejs#49487
This commit adds a new --test-concurrency CLI flag that controls the parallelism of the test runner CLI. PR-URL: nodejs#49996 Fixes: nodejs#49487 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit adds a new --test-concurrency CLI flag that controls the parallelism of the test runner CLI. PR-URL: #49996 Fixes: #49487 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit adds a new --test-concurrency CLI flag that controls the parallelism of the test runner CLI. PR-URL: #49996 Fixes: #49487 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit adds a new --test-concurrency CLI flag that controls the parallelism of the test runner CLI. PR-URL: nodejs#49996 Fixes: nodejs#49487 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit adds a new --test-concurrency CLI flag that controls the parallelism of the test runner CLI. PR-URL: nodejs/node#49996 Fixes: nodejs/node#49487 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit adds a new --test-concurrency CLI flag that controls the parallelism of the test runner CLI. PR-URL: nodejs/node#49996 Fixes: nodejs/node#49487 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
What is the problem this feature will solve?
Currently it's very hard to use
node:test
to test against an external database or an external service with state as multiple files are automatically run in parallel.What is the feature you are proposing to solve the problem?
Adding a
node --test --test-concurrenty=1
will do the trickWhat alternatives have you considered?
Calling
run
manually.The text was updated successfully, but these errors were encountered: