1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

chore: add test for worker shutting down during npm import (#24109)

This commit is contained in:
David Sherret 2024-06-10 07:46:28 -04:00 committed by GitHub
parent 31154ff958
commit 3be0a1e8b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 48 additions and 0 deletions

View file

@ -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"
}
}
}

View file

@ -0,0 +1,4 @@
[UNORDERED_START]
1
2
[UNORDERED_END]

View file

@ -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",
});

View file

@ -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",
];

View file

@ -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();

View file

@ -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");