-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unref shared worker when all test workers have deregistered
This should prevent the main process from exiting prematurely with a 0 exit code. See background in #3149 (comment).
- Loading branch information
1 parent
4ecfe7d
commit 639b905
Showing
5 changed files
with
43 additions
and
10 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"type": "module", | ||
"ava": { | ||
"files": [ | ||
"*.js" | ||
], | ||
"timeout": "5s" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import test from 'ava'; | ||
import {registerSharedWorker} from 'ava/plugin'; | ||
import delay from 'delay'; | ||
|
||
registerSharedWorker({ | ||
filename: new URL('worker.mjs', import.meta.url), | ||
supportedProtocols: ['ava-4'], | ||
}); | ||
|
||
test('time out', async t => { | ||
await delay(10_000); | ||
|
||
t.pass(); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default ({negotiateProtocol}) => { | ||
negotiateProtocol(['ava-4']).ready(); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import test from '@ava/test'; | ||
|
||
import {fixture} from '../../helpers/exec.js'; | ||
|
||
test('times out', async t => { | ||
const error = await t.throwsAsync(async () => fixture()); | ||
|
||
t.is(error.exitCode, 1); | ||
}); |