Skip to content

Commit 96ff6ef

Browse files
committed
Mitigate a racy test
A worker cannot observe a peer-failed message sent before it started listening.
1 parent 19bed42 commit 96ff6ef

File tree

1 file changed

+9
-2
lines changed
  • test-tap/fixture/fail-fast/multiple-files

1 file changed

+9
-2
lines changed
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
const test = require('../../../../entrypoints/main.cjs');
22

3+
// Allow some time for all workers to launch.
4+
const grace = new Promise(resolve => {
5+
setTimeout(resolve, 500);
6+
});
7+
38
test('first pass', t => {
49
t.pass();
510
});
611

7-
test('second fail', t => {
12+
test('second fail', async t => {
13+
await grace;
814
t.fail();
915
});
1016

11-
test('third pass', t => {
17+
test('third pass', async t => {
18+
await grace;
1219
t.pass();
1320
});

0 commit comments

Comments
 (0)