Skip to content

Commit 5c56081

Browse files
aduh95targos
authored andcommitted
test: deflake test-loaders-workers-spawned
PR-URL: #50251 Fixes: #50247 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 3441e19 commit 5c56081

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/es-module/test-loaders-workers-spawned.mjs

+7-1
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,14 @@ describe('Worker threads do not spawn infinitely', { concurrency: true }, () =>
4848
]);
4949

5050
assert.strictEqual(stderr, '');
51+
// We are validating that:
52+
// 1. the `--require` flag is run first from the main thread (and A is printed).
53+
// 2. the `--require` flag is then run on the loader thread (and A is printed).
54+
// 3. the `--loader` module is executed (and B is printed).
55+
// 4. the `--import` module is evaluated once, on the main thread (and C is printed).
56+
// 5. the user code is finally executed (and D is printed).
5157
// The worker code should always run before the --import, but the console.log might arrive late.
52-
assert.match(stdout, /^A\r?\nA\r?\n(B\r?\nC|C\r?\nB)\r?\nD\r?\n$/);
58+
assert.match(stdout, /^A\r?\n(A\r?\nB\r?\nC|A\r?\nC\r?\nB|C\r?\nA\r?\nB)\r?\nD\r?\n$/);
5359
assert.strictEqual(code, 0);
5460
assert.strictEqual(signal, null);
5561
});

0 commit comments

Comments
 (0)