Skip to content

Commit 48da608

Browse files
committed
test: deflake test-loaders-workers-spawned
PR-URL: nodejs/node#50251 Backport-PR-URL: nodejs/node#50669 Fixes: nodejs/node#50247 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 52a27e2 commit 48da608

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

graal-nodejs/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)