forked from denoland/deno
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add test for worker shutting down during npm import (denoland#…
- Loading branch information
Showing
6 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
tests/specs/npm/worker_shutdown_during_npm_import/__test__.jsonc
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,13 @@ | ||
{ | ||
"tempDir": true, | ||
"tests": { | ||
"with_lock": { | ||
"args": "run -A --quiet --lock=deno.lock main.ts", | ||
"output": "main.out" | ||
}, | ||
"without_lock": { | ||
"args": "run -A --quiet main.ts", | ||
"output": "main.out" | ||
} | ||
} | ||
} |
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,4 @@ | ||
[UNORDERED_START] | ||
1 | ||
2 | ||
[UNORDERED_END] |
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,6 @@ | ||
new Worker(new URL("./worker1.ts", import.meta.url), { | ||
type: "module", | ||
}); | ||
new Worker(new URL("./worker2.ts", import.meta.url), { | ||
type: "module", | ||
}); |
11 changes: 11 additions & 0 deletions
11
tests/specs/npm/worker_shutdown_during_npm_import/specifiers.ts
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,11 @@ | ||
export default [ | ||
"npm:chalk@4", | ||
"npm:[email protected]", | ||
"npm:[email protected]", | ||
"npm:ajv", | ||
"npm:has", | ||
"npm:picocolors", | ||
"npm:@denotest/esm-basic", | ||
"npm:@denotest/add", | ||
"npm:@denotest/subtract", | ||
]; |
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,7 @@ | ||
import specifiers from "./specifiers.ts"; | ||
await new Promise((resolve) => setTimeout(() => resolve(), 20)); | ||
|
||
await Promise.all(specifiers.map((specifier) => import(specifier))); | ||
|
||
console.log(1); | ||
self.close(); |
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,7 @@ | ||
import specifiers from "./specifiers.ts"; | ||
// start importing, but close after waiting a short amount of time | ||
specifiers.map((specifier) => import(specifier)); | ||
await new Promise((resolve) => setTimeout(() => resolve(), 20)); | ||
console.log(2); | ||
self.close(); | ||
console.log("WILL NOT BE PRINTED"); |