summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/specs/npm/adding_npm_dep_in_dynamic_import/__test__.jsonc19
-rw-r--r--tests/specs/npm/adding_npm_dep_in_dynamic_import/deno.json7
-rw-r--r--tests/specs/npm/adding_npm_dep_in_dynamic_import/lock.out20
-rw-r--r--tests/specs/npm/adding_npm_dep_in_dynamic_import/main.out8
-rw-r--r--tests/specs/npm/adding_npm_dep_in_dynamic_import/main.ts8
-rw-r--r--tests/specs/npm/adding_npm_dep_in_dynamic_import/main2.out6
-rw-r--r--tests/specs/npm/adding_npm_dep_in_dynamic_import/other.ts1
7 files changed, 69 insertions, 0 deletions
diff --git a/tests/specs/npm/adding_npm_dep_in_dynamic_import/__test__.jsonc b/tests/specs/npm/adding_npm_dep_in_dynamic_import/__test__.jsonc
new file mode 100644
index 000000000..4dcedd92f
--- /dev/null
+++ b/tests/specs/npm/adding_npm_dep_in_dynamic_import/__test__.jsonc
@@ -0,0 +1,19 @@
+{
+ "tempDir": true,
+ "steps": [{
+ "args": "run --allow-read=. main.ts",
+ "output": "main.out"
+ }, {
+ "args": "task --quiet cat deno.lock",
+ "output": "lock.out"
+ }, {
+ "args": "task rm_node_modules",
+ "output": "[WILDCARD]"
+ }, {
+ "args": "run --allow-read=. main.ts",
+ "output": "main2.out"
+ }, {
+ "args": "task --quiet cat deno.lock",
+ "output": "lock.out"
+ }]
+}
diff --git a/tests/specs/npm/adding_npm_dep_in_dynamic_import/deno.json b/tests/specs/npm/adding_npm_dep_in_dynamic_import/deno.json
new file mode 100644
index 000000000..38bbf89a0
--- /dev/null
+++ b/tests/specs/npm/adding_npm_dep_in_dynamic_import/deno.json
@@ -0,0 +1,7 @@
+{
+ "nodeModulesDir": true,
+ "tasks": {
+ "cat": "cat",
+ "rm_node_modules": "rm -rf node_modules"
+ }
+}
diff --git a/tests/specs/npm/adding_npm_dep_in_dynamic_import/lock.out b/tests/specs/npm/adding_npm_dep_in_dynamic_import/lock.out
new file mode 100644
index 000000000..c67be75c9
--- /dev/null
+++ b/tests/specs/npm/adding_npm_dep_in_dynamic_import/lock.out
@@ -0,0 +1,20 @@
+{
+ "version": "3",
+ "packages": {
+ "specifiers": {
+ "npm:@denotest/add": "npm:@denotest/add@1.0.0",
+ "npm:@denotest/subtract": "npm:@denotest/subtract@1.0.0"
+ },
+ "npm": {
+ "@denotest/add@1.0.0": {
+ "integrity": "[WILDLINE]",
+ "dependencies": {}
+ },
+ "@denotest/subtract@1.0.0": {
+ "integrity": "[WILDLINE]",
+ "dependencies": {}
+ }
+ }
+ },
+ "remote": {}
+}
diff --git a/tests/specs/npm/adding_npm_dep_in_dynamic_import/main.out b/tests/specs/npm/adding_npm_dep_in_dynamic_import/main.out
new file mode 100644
index 000000000..fe612aa3c
--- /dev/null
+++ b/tests/specs/npm/adding_npm_dep_in_dynamic_import/main.out
@@ -0,0 +1,8 @@
+Download http://localhost:4260/@denotest/add
+Download http://localhost:4260/@denotest/add/1.0.0.tgz
+Initialize @denotest/add@1.0.0
+3
+Download http://localhost:4260/@denotest/subtract
+Download http://localhost:4260/@denotest/subtract/1.0.0.tgz
+Initialize @denotest/subtract@1.0.0
+1
diff --git a/tests/specs/npm/adding_npm_dep_in_dynamic_import/main.ts b/tests/specs/npm/adding_npm_dep_in_dynamic_import/main.ts
new file mode 100644
index 000000000..75e9b9199
--- /dev/null
+++ b/tests/specs/npm/adding_npm_dep_in_dynamic_import/main.ts
@@ -0,0 +1,8 @@
+import { add } from "npm:@denotest/add";
+
+console.log(add(1, 2));
+
+const fileName = "other.ts";
+const specifier = "./" + fileName; // non-analyzable
+const { subtract } = await import(specifier);
+console.log(subtract(3, 2));
diff --git a/tests/specs/npm/adding_npm_dep_in_dynamic_import/main2.out b/tests/specs/npm/adding_npm_dep_in_dynamic_import/main2.out
new file mode 100644
index 000000000..7f1598ed0
--- /dev/null
+++ b/tests/specs/npm/adding_npm_dep_in_dynamic_import/main2.out
@@ -0,0 +1,6 @@
+[UNORDERED_START]
+Initialize @denotest/add@1.0.0
+Initialize @denotest/subtract@1.0.0
+[UNORDERED_END]
+3
+1
diff --git a/tests/specs/npm/adding_npm_dep_in_dynamic_import/other.ts b/tests/specs/npm/adding_npm_dep_in_dynamic_import/other.ts
new file mode 100644
index 000000000..b8487fa51
--- /dev/null
+++ b/tests/specs/npm/adding_npm_dep_in_dynamic_import/other.ts
@@ -0,0 +1 @@
+export * from "npm:@denotest/subtract";