Skip to content

Commit

Permalink
Mitigate a racy test
Browse files Browse the repository at this point in the history
A worker cannot observe a peer-failed message sent before it started listening.
  • Loading branch information
gibson042 committed Aug 16, 2022
1 parent 19bed42 commit 96ff6ef
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test-tap/fixture/fail-fast/multiple-files/fails.cjs
@@ -1,13 +1,20 @@
const test = require('../../../../entrypoints/main.cjs');

// Allow some time for all workers to launch.
const grace = new Promise(resolve => {
setTimeout(resolve, 500);
});

test('first pass', t => {
t.pass();
});

test('second fail', t => {
test('second fail', async t => {
await grace;
t.fail();
});

test('third pass', t => {
test('third pass', async t => {
await grace;
t.pass();
});

0 comments on commit 96ff6ef

Please sign in to comment.