mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
chore: add test for worker shutting down during npm import (#24109)
This commit is contained in:
parent
31154ff958
commit
3be0a1e8b4
6 changed files with 48 additions and 0 deletions
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
[UNORDERED_START]
|
||||
1
|
||||
2
|
||||
[UNORDERED_END]
|
|
@ -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",
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
export default [
|
||||
"npm:chalk@4",
|
||||
"npm:react@18.2",
|
||||
"npm:preact@10.19",
|
||||
"npm:ajv",
|
||||
"npm:has",
|
||||
"npm:picocolors",
|
||||
"npm:@denotest/esm-basic",
|
||||
"npm:@denotest/add",
|
||||
"npm:@denotest/subtract",
|
||||
];
|
|
@ -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();
|
|
@ -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");
|
Loading…
Reference in a new issue