summaryrefslogtreecommitdiff
path: root/tests/specs/npm
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-06-05 11:04:16 -0400
committerGitHub <noreply@github.com>2024-06-05 17:04:16 +0200
commit7ed90a20d04982ae15a52ae2378cbffd4b6839df (patch)
tree3297d6f7227fbf1cf80e17a2a376ef4dfa52e6ad /tests/specs/npm
parent0544d60012006b1c7799d8b6eafacec9567901ad (diff)
fix: better handling of npm resolution occurring on workers (#24094)
Closes https://github.com/denoland/deno/issues/24063
Diffstat (limited to 'tests/specs/npm')
-rw-r--r--tests/specs/npm/workers/__test__.jsonc5
-rw-r--r--tests/specs/npm/workers/main.out5
-rw-r--r--tests/specs/npm/workers/main.ts9
-rw-r--r--tests/specs/npm/workers/worker1.ts9
-rw-r--r--tests/specs/npm/workers/worker2.ts6
-rw-r--r--tests/specs/npm/workers/worker3.ts6
6 files changed, 40 insertions, 0 deletions
diff --git a/tests/specs/npm/workers/__test__.jsonc b/tests/specs/npm/workers/__test__.jsonc
new file mode 100644
index 000000000..f2066c17f
--- /dev/null
+++ b/tests/specs/npm/workers/__test__.jsonc
@@ -0,0 +1,5 @@
+{
+ "tempDir": true,
+ "args": "run -A --quiet --lock=deno.lock main.ts",
+ "output": "main.out"
+}
diff --git a/tests/specs/npm/workers/main.out b/tests/specs/npm/workers/main.out
new file mode 100644
index 000000000..55ff51cd3
--- /dev/null
+++ b/tests/specs/npm/workers/main.out
@@ -0,0 +1,5 @@
+[UNORDERED_START]
+1
+2
+3
+[UNORDERED_END]
diff --git a/tests/specs/npm/workers/main.ts b/tests/specs/npm/workers/main.ts
new file mode 100644
index 000000000..f51cf4d90
--- /dev/null
+++ b/tests/specs/npm/workers/main.ts
@@ -0,0 +1,9 @@
+new Worker(new URL("./worker1.ts", import.meta.url), {
+ type: "module",
+});
+new Worker(new URL("./worker2.ts", import.meta.url), {
+ type: "module",
+});
+new Worker(new URL("./worker3.ts", import.meta.url), {
+ type: "module",
+});
diff --git a/tests/specs/npm/workers/worker1.ts b/tests/specs/npm/workers/worker1.ts
new file mode 100644
index 000000000..1cdc91d56
--- /dev/null
+++ b/tests/specs/npm/workers/worker1.ts
@@ -0,0 +1,9 @@
+import "npm:chalk@4";
+import "npm:react@18.2";
+import "npm:preact@10.19";
+import "npm:ajv";
+import "npm:has";
+import "npm:picocolors";
+
+console.log(1);
+self.close();
diff --git a/tests/specs/npm/workers/worker2.ts b/tests/specs/npm/workers/worker2.ts
new file mode 100644
index 000000000..2495ebacc
--- /dev/null
+++ b/tests/specs/npm/workers/worker2.ts
@@ -0,0 +1,6 @@
+import "npm:@denotest/esm-basic";
+import "npm:@denotest/add";
+import "npm:@denotest/subtract";
+
+console.log(2);
+self.close();
diff --git a/tests/specs/npm/workers/worker3.ts b/tests/specs/npm/workers/worker3.ts
new file mode 100644
index 000000000..ae18d6aa9
--- /dev/null
+++ b/tests/specs/npm/workers/worker3.ts
@@ -0,0 +1,6 @@
+import "npm:@denotest/subtract";
+import "npm:@denotest/add";
+import "npm:@denotest/esm-basic";
+
+console.log(3);
+self.close();