-
Notifications
You must be signed in to change notification settings - Fork 30.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: prevent flaky behavior in test runner bail option
- Loading branch information
Showing
5 changed files
with
48 additions
and
34 deletions.
There are no files selected for viewing
21 changes: 17 additions & 4 deletions
21
test/fixtures/test-runner/bailout/parallel-concurrency/first.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 10 additions & 2 deletions
12
test/fixtures/test-runner/bailout/parallel-concurrency/second.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
import { writeFileSync } from 'node:fs'; | ||
import { describe, it } from 'node:test'; | ||
import { setTimeout } from 'node:timers/promises'; | ||
|
||
const testSyncPath = process.env.__TEST_SYNC_PATH__; | ||
|
||
describe('second parallel file', () => { | ||
it('slow test that should be cancelled', async () => { | ||
await new Promise((resolve) => setTimeout(resolve, 5000)); | ||
// Create a file to signal that the second test has started | ||
writeFileSync(`${testSyncPath}/second-file`, 'second file content'); | ||
it('slow test that should be cancelled', async (t) => { | ||
while (true) { | ||
await setTimeout(5000); | ||
} | ||
}); | ||
}); |
10 changes: 0 additions & 10 deletions
10
test/fixtures/test-runner/bailout/parallel-loading/infinite-loop.mjs
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
test/fixtures/test-runner/bailout/parallel-loading/slow-loading.mjs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters