summaryrefslogtreecommitdiff
path: root/tests/specs
diff options
context:
space:
mode:
authorBartek Iwańczuk <biwanczuk@gmail.com>2024-09-16 14:39:58 +0100
committerGitHub <noreply@github.com>2024-09-16 15:39:58 +0200
commit968f441da32ae5fc3783a4f9bcda3d34fa276b4d (patch)
tree9dee28c5203fd326ddc0c60020e97bd1a6a12748 /tests/specs
parent8fa92228bb748bdc59e0fe003108dcaea0a18d10 (diff)
test: rewrite some ignored tests to spec tests (#25652)
Ref https://github.com/denoland/deno/issues/25241 Rewritten these tests: - check::package_json_basic - check::package_json_fail_check - check::package_json_with_deno_json - info::package_json_basic - test::package_json_basic - run::package_json_auto_discovered_for_npm_binary - run::package_json_with_deno_json
Diffstat (limited to 'tests/specs')
-rw-r--r--tests/specs/check/package_json/__test__.jsonc13
-rw-r--r--tests/specs/check/package_json/check.out1
-rw-r--r--tests/specs/check/package_json/install.out3
-rw-r--r--tests/specs/check/package_json/lib.ts9
-rw-r--r--tests/specs/check/package_json/main.ts3
-rw-r--r--tests/specs/check/package_json/package.json5
-rw-r--r--tests/specs/check/package_json_auto_install/__test__.jsonc9
-rw-r--r--tests/specs/check/package_json_auto_install/check.out4
-rw-r--r--tests/specs/check/package_json_auto_install/deno.json3
-rw-r--r--tests/specs/check/package_json_auto_install/lib.ts9
-rw-r--r--tests/specs/check/package_json_auto_install/main.ts3
-rw-r--r--tests/specs/check/package_json_auto_install/package.json5
-rw-r--r--tests/specs/check/package_json_fail_check/__test__.jsonc14
-rw-r--r--tests/specs/check/package_json_fail_check/fail_check.out4
-rw-r--r--tests/specs/check/package_json_fail_check/fail_check.ts3
-rw-r--r--tests/specs/check/package_json_fail_check/install.out3
-rw-r--r--tests/specs/check/package_json_fail_check/lib.ts9
-rw-r--r--tests/specs/check/package_json_fail_check/package.json5
-rw-r--r--tests/specs/check/package_json_with_deno_json/__test__.jsonc14
-rw-r--r--tests/specs/check/package_json_with_deno_json/check.out11
-rw-r--r--tests/specs/check/package_json_with_deno_json/deno.json5
-rw-r--r--tests/specs/check/package_json_with_deno_json/install.out3
-rw-r--r--tests/specs/check/package_json_with_deno_json/main.ts9
-rw-r--r--tests/specs/check/package_json_with_deno_json/other.ts3
-rw-r--r--tests/specs/check/package_json_with_deno_json/package.json5
-rw-r--r--tests/specs/info/package_json_basic/__test__.jsonc13
-rw-r--r--tests/specs/info/package_json_basic/info.out9
-rw-r--r--tests/specs/info/package_json_basic/install.out3
-rw-r--r--tests/specs/info/package_json_basic/lib.ts9
-rw-r--r--tests/specs/info/package_json_basic/main.ts3
-rw-r--r--tests/specs/info/package_json_basic/package.json5
-rw-r--r--tests/specs/info/package_json_basic_auto_install/__test__.jsonc9
-rw-r--r--tests/specs/info/package_json_basic_auto_install/deno.json3
-rw-r--r--tests/specs/info/package_json_basic_auto_install/info.out8
-rw-r--r--tests/specs/info/package_json_basic_auto_install/lib.ts9
-rw-r--r--tests/specs/info/package_json_basic_auto_install/main.ts3
-rw-r--r--tests/specs/info/package_json_basic_auto_install/package.json5
-rw-r--r--tests/specs/run/package_json/with_deno_json/__test__.jsonc16
-rw-r--r--tests/specs/run/package_json/with_deno_json/deno.json3
-rw-r--r--tests/specs/run/package_json/with_deno_json/lib.ts9
-rw-r--r--tests/specs/run/package_json/with_deno_json/lock.out18
-rw-r--r--tests/specs/run/package_json/with_deno_json/main.out1
-rw-r--r--tests/specs/run/package_json/with_deno_json/main.ts3
-rw-r--r--tests/specs/run/package_json/with_deno_json/package.json5
-rw-r--r--tests/specs/run/package_json_auto_discovered_for_npm_binary/__test__.jsonc5
-rw-r--r--tests/specs/run/package_json_auto_discovered_for_npm_binary/deno.json3
-rw-r--r--tests/specs/run/package_json_auto_discovered_for_npm_binary/main.out8
-rw-r--r--tests/specs/run/package_json_auto_discovered_for_npm_binary/package.json8
-rw-r--r--tests/specs/test/package_json_basic/__test__.jsonc13
-rw-r--r--tests/specs/test/package_json_basic/install.out3
-rw-r--r--tests/specs/test/package_json_basic/lib.test.ts7
-rw-r--r--tests/specs/test/package_json_basic/lib.ts9
-rw-r--r--tests/specs/test/package_json_basic/package.json5
-rw-r--r--tests/specs/test/package_json_basic/test.out6
-rw-r--r--tests/specs/test/package_json_basic_auto_install/__test__.jsonc9
-rw-r--r--tests/specs/test/package_json_basic_auto_install/deno.json3
-rw-r--r--tests/specs/test/package_json_basic_auto_install/lib.test.ts7
-rw-r--r--tests/specs/test/package_json_basic_auto_install/lib.ts9
-rw-r--r--tests/specs/test/package_json_basic_auto_install/package.json5
-rw-r--r--tests/specs/test/package_json_basic_auto_install/test.out9
60 files changed, 398 insertions, 0 deletions
diff --git a/tests/specs/check/package_json/__test__.jsonc b/tests/specs/check/package_json/__test__.jsonc
new file mode 100644
index 000000000..29a964b9f
--- /dev/null
+++ b/tests/specs/check/package_json/__test__.jsonc
@@ -0,0 +1,13 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "install",
+ "output": "install.out"
+ },
+ {
+ "args": "check main.ts",
+ "output": "check.out"
+ }
+ ]
+}
diff --git a/tests/specs/check/package_json/check.out b/tests/specs/check/package_json/check.out
new file mode 100644
index 000000000..bb9406725
--- /dev/null
+++ b/tests/specs/check/package_json/check.out
@@ -0,0 +1 @@
+Check file://[WILDCARD]/main.ts
diff --git a/tests/specs/check/package_json/install.out b/tests/specs/check/package_json/install.out
new file mode 100644
index 000000000..b8114c12a
--- /dev/null
+++ b/tests/specs/check/package_json/install.out
@@ -0,0 +1,3 @@
+Download http://localhost:4260/@denotest/esm-basic
+Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
+Initialize @denotest/esm-basic@1.0.0
diff --git a/tests/specs/check/package_json/lib.ts b/tests/specs/check/package_json/lib.ts
new file mode 100644
index 000000000..1deed81f7
--- /dev/null
+++ b/tests/specs/check/package_json/lib.ts
@@ -0,0 +1,9 @@
+import * as test from "@denotest/esm-basic";
+
+export function add(a: number, b: number) {
+ return a + b;
+}
+
+export function getValue() {
+ return test.getValue();
+}
diff --git a/tests/specs/check/package_json/main.ts b/tests/specs/check/package_json/main.ts
new file mode 100644
index 000000000..e241f3002
--- /dev/null
+++ b/tests/specs/check/package_json/main.ts
@@ -0,0 +1,3 @@
+import { getValue } from "./lib.ts";
+
+console.log(getValue());
diff --git a/tests/specs/check/package_json/package.json b/tests/specs/check/package_json/package.json
new file mode 100644
index 000000000..54ca824d6
--- /dev/null
+++ b/tests/specs/check/package_json/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ }
+}
diff --git a/tests/specs/check/package_json_auto_install/__test__.jsonc b/tests/specs/check/package_json_auto_install/__test__.jsonc
new file mode 100644
index 000000000..3fa33cdb7
--- /dev/null
+++ b/tests/specs/check/package_json_auto_install/__test__.jsonc
@@ -0,0 +1,9 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "check main.ts",
+ "output": "check.out"
+ }
+ ]
+}
diff --git a/tests/specs/check/package_json_auto_install/check.out b/tests/specs/check/package_json_auto_install/check.out
new file mode 100644
index 000000000..db9bd198c
--- /dev/null
+++ b/tests/specs/check/package_json_auto_install/check.out
@@ -0,0 +1,4 @@
+Download http://localhost:4260/@denotest/esm-basic
+Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
+Initialize @denotest/esm-basic@1.0.0
+Check file://[WILDCARD]/main.ts
diff --git a/tests/specs/check/package_json_auto_install/deno.json b/tests/specs/check/package_json_auto_install/deno.json
new file mode 100644
index 000000000..fbd70ec48
--- /dev/null
+++ b/tests/specs/check/package_json_auto_install/deno.json
@@ -0,0 +1,3 @@
+{
+ "nodeModulesDir": "auto"
+}
diff --git a/tests/specs/check/package_json_auto_install/lib.ts b/tests/specs/check/package_json_auto_install/lib.ts
new file mode 100644
index 000000000..1deed81f7
--- /dev/null
+++ b/tests/specs/check/package_json_auto_install/lib.ts
@@ -0,0 +1,9 @@
+import * as test from "@denotest/esm-basic";
+
+export function add(a: number, b: number) {
+ return a + b;
+}
+
+export function getValue() {
+ return test.getValue();
+}
diff --git a/tests/specs/check/package_json_auto_install/main.ts b/tests/specs/check/package_json_auto_install/main.ts
new file mode 100644
index 000000000..e241f3002
--- /dev/null
+++ b/tests/specs/check/package_json_auto_install/main.ts
@@ -0,0 +1,3 @@
+import { getValue } from "./lib.ts";
+
+console.log(getValue());
diff --git a/tests/specs/check/package_json_auto_install/package.json b/tests/specs/check/package_json_auto_install/package.json
new file mode 100644
index 000000000..54ca824d6
--- /dev/null
+++ b/tests/specs/check/package_json_auto_install/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ }
+}
diff --git a/tests/specs/check/package_json_fail_check/__test__.jsonc b/tests/specs/check/package_json_fail_check/__test__.jsonc
new file mode 100644
index 000000000..e5b4a4db0
--- /dev/null
+++ b/tests/specs/check/package_json_fail_check/__test__.jsonc
@@ -0,0 +1,14 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "install",
+ "output": "install.out"
+ },
+ {
+ "args": "check --quiet fail_check.ts",
+ "output": "fail_check.out",
+ "exitCode": 1
+ }
+ ]
+}
diff --git a/tests/specs/check/package_json_fail_check/fail_check.out b/tests/specs/check/package_json_fail_check/fail_check.out
new file mode 100644
index 000000000..03997a051
--- /dev/null
+++ b/tests/specs/check/package_json_fail_check/fail_check.out
@@ -0,0 +1,4 @@
+error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
+const _test: string = getValue();
+ ~~~~~
+ at file:///[WILDCARD]/fail_check.ts:3:7
diff --git a/tests/specs/check/package_json_fail_check/fail_check.ts b/tests/specs/check/package_json_fail_check/fail_check.ts
new file mode 100644
index 000000000..cef10763d
--- /dev/null
+++ b/tests/specs/check/package_json_fail_check/fail_check.ts
@@ -0,0 +1,3 @@
+import { getValue } from "./lib.ts";
+
+const _test: string = getValue();
diff --git a/tests/specs/check/package_json_fail_check/install.out b/tests/specs/check/package_json_fail_check/install.out
new file mode 100644
index 000000000..b8114c12a
--- /dev/null
+++ b/tests/specs/check/package_json_fail_check/install.out
@@ -0,0 +1,3 @@
+Download http://localhost:4260/@denotest/esm-basic
+Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
+Initialize @denotest/esm-basic@1.0.0
diff --git a/tests/specs/check/package_json_fail_check/lib.ts b/tests/specs/check/package_json_fail_check/lib.ts
new file mode 100644
index 000000000..1deed81f7
--- /dev/null
+++ b/tests/specs/check/package_json_fail_check/lib.ts
@@ -0,0 +1,9 @@
+import * as test from "@denotest/esm-basic";
+
+export function add(a: number, b: number) {
+ return a + b;
+}
+
+export function getValue() {
+ return test.getValue();
+}
diff --git a/tests/specs/check/package_json_fail_check/package.json b/tests/specs/check/package_json_fail_check/package.json
new file mode 100644
index 000000000..54ca824d6
--- /dev/null
+++ b/tests/specs/check/package_json_fail_check/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ }
+}
diff --git a/tests/specs/check/package_json_with_deno_json/__test__.jsonc b/tests/specs/check/package_json_with_deno_json/__test__.jsonc
new file mode 100644
index 000000000..13752ebee
--- /dev/null
+++ b/tests/specs/check/package_json_with_deno_json/__test__.jsonc
@@ -0,0 +1,14 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "install",
+ "output": "install.out"
+ },
+ {
+ "args": "check --quiet main.ts",
+ "output": "check.out",
+ "exitCode": 1
+ }
+ ]
+}
diff --git a/tests/specs/check/package_json_with_deno_json/check.out b/tests/specs/check/package_json_with_deno_json/check.out
new file mode 100644
index 000000000..53b6869c0
--- /dev/null
+++ b/tests/specs/check/package_json_with_deno_json/check.out
@@ -0,0 +1,11 @@
+error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
+const _strValue1: string = NUMBER_VALUE;
+ ~~~~~~~~~~
+ at file:///[WILDCARD]/main.ts:8:7
+
+TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
+const _strValue2: string = test.getValue();
+ ~~~~~~~~~~
+ at file:///[WILDCARD]/main.ts:9:7
+
+Found 2 errors.
diff --git a/tests/specs/check/package_json_with_deno_json/deno.json b/tests/specs/check/package_json_with_deno_json/deno.json
new file mode 100644
index 000000000..8a89da280
--- /dev/null
+++ b/tests/specs/check/package_json_with_deno_json/deno.json
@@ -0,0 +1,5 @@
+{
+ "imports": {
+ "other": "./other.ts"
+ }
+}
diff --git a/tests/specs/check/package_json_with_deno_json/install.out b/tests/specs/check/package_json_with_deno_json/install.out
new file mode 100644
index 000000000..b8114c12a
--- /dev/null
+++ b/tests/specs/check/package_json_with_deno_json/install.out
@@ -0,0 +1,3 @@
+Download http://localhost:4260/@denotest/esm-basic
+Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
+Initialize @denotest/esm-basic@1.0.0
diff --git a/tests/specs/check/package_json_with_deno_json/main.ts b/tests/specs/check/package_json_with_deno_json/main.ts
new file mode 100644
index 000000000..7768ff3fc
--- /dev/null
+++ b/tests/specs/check/package_json_with_deno_json/main.ts
@@ -0,0 +1,9 @@
+import { NUMBER_VALUE } from "other";
+import * as test from "@denotest/esm-basic";
+
+test.setValue(2);
+console.log(test.getValue());
+
+// these should cause type errors
+const _strValue1: string = NUMBER_VALUE;
+const _strValue2: string = test.getValue();
diff --git a/tests/specs/check/package_json_with_deno_json/other.ts b/tests/specs/check/package_json_with_deno_json/other.ts
new file mode 100644
index 000000000..997d84adf
--- /dev/null
+++ b/tests/specs/check/package_json_with_deno_json/other.ts
@@ -0,0 +1,3 @@
+console.log(1);
+
+export const NUMBER_VALUE = 1;
diff --git a/tests/specs/check/package_json_with_deno_json/package.json b/tests/specs/check/package_json_with_deno_json/package.json
new file mode 100644
index 000000000..54ca824d6
--- /dev/null
+++ b/tests/specs/check/package_json_with_deno_json/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ }
+}
diff --git a/tests/specs/info/package_json_basic/__test__.jsonc b/tests/specs/info/package_json_basic/__test__.jsonc
new file mode 100644
index 000000000..c5672615c
--- /dev/null
+++ b/tests/specs/info/package_json_basic/__test__.jsonc
@@ -0,0 +1,13 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "install",
+ "output": "install.out"
+ },
+ {
+ "args": "info --quiet main.ts",
+ "output": "info.out"
+ }
+ ]
+}
diff --git a/tests/specs/info/package_json_basic/info.out b/tests/specs/info/package_json_basic/info.out
new file mode 100644
index 000000000..243010131
--- /dev/null
+++ b/tests/specs/info/package_json_basic/info.out
@@ -0,0 +1,9 @@
+local: [WILDCARD]main.ts
+type: TypeScript
+dependencies: 3 unique
+size: [WILDCARD]
+
+file:///[WILDCARD]/main.ts (63B)
+└─┬ file:///[WILDCARD]/lib.ts (166B)
+ ├── file:///[WILDCARD]@denotest/esm-basic/main.mjs (unknown)
+ └── file:///[WILDCARD]@denotest/esm-basic/main.d.mts (unknown)
diff --git a/tests/specs/info/package_json_basic/install.out b/tests/specs/info/package_json_basic/install.out
new file mode 100644
index 000000000..b8114c12a
--- /dev/null
+++ b/tests/specs/info/package_json_basic/install.out
@@ -0,0 +1,3 @@
+Download http://localhost:4260/@denotest/esm-basic
+Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
+Initialize @denotest/esm-basic@1.0.0
diff --git a/tests/specs/info/package_json_basic/lib.ts b/tests/specs/info/package_json_basic/lib.ts
new file mode 100644
index 000000000..1deed81f7
--- /dev/null
+++ b/tests/specs/info/package_json_basic/lib.ts
@@ -0,0 +1,9 @@
+import * as test from "@denotest/esm-basic";
+
+export function add(a: number, b: number) {
+ return a + b;
+}
+
+export function getValue() {
+ return test.getValue();
+}
diff --git a/tests/specs/info/package_json_basic/main.ts b/tests/specs/info/package_json_basic/main.ts
new file mode 100644
index 000000000..e241f3002
--- /dev/null
+++ b/tests/specs/info/package_json_basic/main.ts
@@ -0,0 +1,3 @@
+import { getValue } from "./lib.ts";
+
+console.log(getValue());
diff --git a/tests/specs/info/package_json_basic/package.json b/tests/specs/info/package_json_basic/package.json
new file mode 100644
index 000000000..54ca824d6
--- /dev/null
+++ b/tests/specs/info/package_json_basic/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ }
+}
diff --git a/tests/specs/info/package_json_basic_auto_install/__test__.jsonc b/tests/specs/info/package_json_basic_auto_install/__test__.jsonc
new file mode 100644
index 000000000..a98f89e91
--- /dev/null
+++ b/tests/specs/info/package_json_basic_auto_install/__test__.jsonc
@@ -0,0 +1,9 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "info --quiet main.ts",
+ "output": "info.out"
+ }
+ ]
+}
diff --git a/tests/specs/info/package_json_basic_auto_install/deno.json b/tests/specs/info/package_json_basic_auto_install/deno.json
new file mode 100644
index 000000000..fbd70ec48
--- /dev/null
+++ b/tests/specs/info/package_json_basic_auto_install/deno.json
@@ -0,0 +1,3 @@
+{
+ "nodeModulesDir": "auto"
+}
diff --git a/tests/specs/info/package_json_basic_auto_install/info.out b/tests/specs/info/package_json_basic_auto_install/info.out
new file mode 100644
index 000000000..892c0612a
--- /dev/null
+++ b/tests/specs/info/package_json_basic_auto_install/info.out
@@ -0,0 +1,8 @@
+local: [WILDCARD]main.ts
+type: TypeScript
+dependencies: 2 unique
+size: [WILDCARD]
+
+file:///[WILDCARD]/main.ts (63B)
+└─┬ file:///[WILDCARD]/lib.ts (166B)
+ └── npm:/@denotest/esm-basic@1.0.0 (471B)
diff --git a/tests/specs/info/package_json_basic_auto_install/lib.ts b/tests/specs/info/package_json_basic_auto_install/lib.ts
new file mode 100644
index 000000000..1deed81f7
--- /dev/null
+++ b/tests/specs/info/package_json_basic_auto_install/lib.ts
@@ -0,0 +1,9 @@
+import * as test from "@denotest/esm-basic";
+
+export function add(a: number, b: number) {
+ return a + b;
+}
+
+export function getValue() {
+ return test.getValue();
+}
diff --git a/tests/specs/info/package_json_basic_auto_install/main.ts b/tests/specs/info/package_json_basic_auto_install/main.ts
new file mode 100644
index 000000000..e241f3002
--- /dev/null
+++ b/tests/specs/info/package_json_basic_auto_install/main.ts
@@ -0,0 +1,3 @@
+import { getValue } from "./lib.ts";
+
+console.log(getValue());
diff --git a/tests/specs/info/package_json_basic_auto_install/package.json b/tests/specs/info/package_json_basic_auto_install/package.json
new file mode 100644
index 000000000..54ca824d6
--- /dev/null
+++ b/tests/specs/info/package_json_basic_auto_install/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ }
+}
diff --git a/tests/specs/run/package_json/with_deno_json/__test__.jsonc b/tests/specs/run/package_json/with_deno_json/__test__.jsonc
new file mode 100644
index 000000000..13b6b6de1
--- /dev/null
+++ b/tests/specs/run/package_json/with_deno_json/__test__.jsonc
@@ -0,0 +1,16 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "run --quiet -A main.ts",
+ "output": "main.out"
+ },
+ {
+ "args": [
+ "eval",
+ "console.log(Deno.readTextFileSync('deno.lock').trim())"
+ ],
+ "output": "lock.out"
+ }
+ ]
+}
diff --git a/tests/specs/run/package_json/with_deno_json/deno.json b/tests/specs/run/package_json/with_deno_json/deno.json
new file mode 100644
index 000000000..fbd70ec48
--- /dev/null
+++ b/tests/specs/run/package_json/with_deno_json/deno.json
@@ -0,0 +1,3 @@
+{
+ "nodeModulesDir": "auto"
+}
diff --git a/tests/specs/run/package_json/with_deno_json/lib.ts b/tests/specs/run/package_json/with_deno_json/lib.ts
new file mode 100644
index 000000000..1deed81f7
--- /dev/null
+++ b/tests/specs/run/package_json/with_deno_json/lib.ts
@@ -0,0 +1,9 @@
+import * as test from "@denotest/esm-basic";
+
+export function add(a: number, b: number) {
+ return a + b;
+}
+
+export function getValue() {
+ return test.getValue();
+}
diff --git a/tests/specs/run/package_json/with_deno_json/lock.out b/tests/specs/run/package_json/with_deno_json/lock.out
new file mode 100644
index 000000000..92aa561b8
--- /dev/null
+++ b/tests/specs/run/package_json/with_deno_json/lock.out
@@ -0,0 +1,18 @@
+{
+ "version": "4",
+ "specifiers": {
+ "npm:@denotest/esm-basic@*": "1.0.0"
+ },
+ "npm": {
+ "@denotest/esm-basic@1.0.0": {
+ "integrity": "sha512-[WILDCARD]"
+ }
+ },
+ "workspace": {
+ "packageJson": {
+ "dependencies": [
+ "npm:@denotest/esm-basic@*"
+ ]
+ }
+ }
+}
diff --git a/tests/specs/run/package_json/with_deno_json/main.out b/tests/specs/run/package_json/with_deno_json/main.out
new file mode 100644
index 000000000..573541ac9
--- /dev/null
+++ b/tests/specs/run/package_json/with_deno_json/main.out
@@ -0,0 +1 @@
+0
diff --git a/tests/specs/run/package_json/with_deno_json/main.ts b/tests/specs/run/package_json/with_deno_json/main.ts
new file mode 100644
index 000000000..e241f3002
--- /dev/null
+++ b/tests/specs/run/package_json/with_deno_json/main.ts
@@ -0,0 +1,3 @@
+import { getValue } from "./lib.ts";
+
+console.log(getValue());
diff --git a/tests/specs/run/package_json/with_deno_json/package.json b/tests/specs/run/package_json/with_deno_json/package.json
new file mode 100644
index 000000000..54ca824d6
--- /dev/null
+++ b/tests/specs/run/package_json/with_deno_json/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ }
+}
diff --git a/tests/specs/run/package_json_auto_discovered_for_npm_binary/__test__.jsonc b/tests/specs/run/package_json_auto_discovered_for_npm_binary/__test__.jsonc
new file mode 100644
index 000000000..dab6ad8d5
--- /dev/null
+++ b/tests/specs/run/package_json_auto_discovered_for_npm_binary/__test__.jsonc
@@ -0,0 +1,5 @@
+{
+ "tempDir": true,
+ "args": "run -L debug npm:@denotest/bin/cli-esm this is a test",
+ "output": "main.out"
+}
diff --git a/tests/specs/run/package_json_auto_discovered_for_npm_binary/deno.json b/tests/specs/run/package_json_auto_discovered_for_npm_binary/deno.json
new file mode 100644
index 000000000..fbd70ec48
--- /dev/null
+++ b/tests/specs/run/package_json_auto_discovered_for_npm_binary/deno.json
@@ -0,0 +1,3 @@
+{
+ "nodeModulesDir": "auto"
+}
diff --git a/tests/specs/run/package_json_auto_discovered_for_npm_binary/main.out b/tests/specs/run/package_json_auto_discovered_for_npm_binary/main.out
new file mode 100644
index 000000000..5f687a098
--- /dev/null
+++ b/tests/specs/run/package_json_auto_discovered_for_npm_binary/main.out
@@ -0,0 +1,8 @@
+[WILDCARD]
+[WILDCARD]package.json file found at '[WILDCARD]package.json'
+[WILDCARD]
+this
+is
+a
+test
+[WILDCARD]
diff --git a/tests/specs/run/package_json_auto_discovered_for_npm_binary/package.json b/tests/specs/run/package_json_auto_discovered_for_npm_binary/package.json
new file mode 100644
index 000000000..9ee3f39a8
--- /dev/null
+++ b/tests/specs/run/package_json_auto_discovered_for_npm_binary/package.json
@@ -0,0 +1,8 @@
+{
+ "dependencies": {
+ "@denotest/check-error": "1.0.0"
+ },
+ "devDependencies": {
+ "@denotest/cjs-default-export": "1.0.0"
+ }
+}
diff --git a/tests/specs/test/package_json_basic/__test__.jsonc b/tests/specs/test/package_json_basic/__test__.jsonc
new file mode 100644
index 000000000..64e43afa5
--- /dev/null
+++ b/tests/specs/test/package_json_basic/__test__.jsonc
@@ -0,0 +1,13 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "install",
+ "output": "install.out"
+ },
+ {
+ "args": "test",
+ "output": "test.out"
+ }
+ ]
+}
diff --git a/tests/specs/test/package_json_basic/install.out b/tests/specs/test/package_json_basic/install.out
new file mode 100644
index 000000000..b8114c12a
--- /dev/null
+++ b/tests/specs/test/package_json_basic/install.out
@@ -0,0 +1,3 @@
+Download http://localhost:4260/@denotest/esm-basic
+Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
+Initialize @denotest/esm-basic@1.0.0
diff --git a/tests/specs/test/package_json_basic/lib.test.ts b/tests/specs/test/package_json_basic/lib.test.ts
new file mode 100644
index 000000000..4e833e1f3
--- /dev/null
+++ b/tests/specs/test/package_json_basic/lib.test.ts
@@ -0,0 +1,7 @@
+import { add } from "./lib.ts";
+
+Deno.test("should add", () => {
+ if (add(1, 2) !== 3) {
+ throw new Error("Fail");
+ }
+});
diff --git a/tests/specs/test/package_json_basic/lib.ts b/tests/specs/test/package_json_basic/lib.ts
new file mode 100644
index 000000000..1deed81f7
--- /dev/null
+++ b/tests/specs/test/package_json_basic/lib.ts
@@ -0,0 +1,9 @@
+import * as test from "@denotest/esm-basic";
+
+export function add(a: number, b: number) {
+ return a + b;
+}
+
+export function getValue() {
+ return test.getValue();
+}
diff --git a/tests/specs/test/package_json_basic/package.json b/tests/specs/test/package_json_basic/package.json
new file mode 100644
index 000000000..54ca824d6
--- /dev/null
+++ b/tests/specs/test/package_json_basic/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ }
+}
diff --git a/tests/specs/test/package_json_basic/test.out b/tests/specs/test/package_json_basic/test.out
new file mode 100644
index 000000000..1ff57c150
--- /dev/null
+++ b/tests/specs/test/package_json_basic/test.out
@@ -0,0 +1,6 @@
+Check file://[WILDCARD]/lib.test.ts
+running 1 test from [WILDCARD]lib.test.ts
+should add ... ok ([WILDCARD])
+
+ok | 1 passed | 0 failed ([WILDCARD])
+
diff --git a/tests/specs/test/package_json_basic_auto_install/__test__.jsonc b/tests/specs/test/package_json_basic_auto_install/__test__.jsonc
new file mode 100644
index 000000000..d80f3222a
--- /dev/null
+++ b/tests/specs/test/package_json_basic_auto_install/__test__.jsonc
@@ -0,0 +1,9 @@
+{
+ "tempDir": true,
+ "steps": [
+ {
+ "args": "test",
+ "output": "test.out"
+ }
+ ]
+}
diff --git a/tests/specs/test/package_json_basic_auto_install/deno.json b/tests/specs/test/package_json_basic_auto_install/deno.json
new file mode 100644
index 000000000..fbd70ec48
--- /dev/null
+++ b/tests/specs/test/package_json_basic_auto_install/deno.json
@@ -0,0 +1,3 @@
+{
+ "nodeModulesDir": "auto"
+}
diff --git a/tests/specs/test/package_json_basic_auto_install/lib.test.ts b/tests/specs/test/package_json_basic_auto_install/lib.test.ts
new file mode 100644
index 000000000..4e833e1f3
--- /dev/null
+++ b/tests/specs/test/package_json_basic_auto_install/lib.test.ts
@@ -0,0 +1,7 @@
+import { add } from "./lib.ts";
+
+Deno.test("should add", () => {
+ if (add(1, 2) !== 3) {
+ throw new Error("Fail");
+ }
+});
diff --git a/tests/specs/test/package_json_basic_auto_install/lib.ts b/tests/specs/test/package_json_basic_auto_install/lib.ts
new file mode 100644
index 000000000..1deed81f7
--- /dev/null
+++ b/tests/specs/test/package_json_basic_auto_install/lib.ts
@@ -0,0 +1,9 @@
+import * as test from "@denotest/esm-basic";
+
+export function add(a: number, b: number) {
+ return a + b;
+}
+
+export function getValue() {
+ return test.getValue();
+}
diff --git a/tests/specs/test/package_json_basic_auto_install/package.json b/tests/specs/test/package_json_basic_auto_install/package.json
new file mode 100644
index 000000000..54ca824d6
--- /dev/null
+++ b/tests/specs/test/package_json_basic_auto_install/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ }
+}
diff --git a/tests/specs/test/package_json_basic_auto_install/test.out b/tests/specs/test/package_json_basic_auto_install/test.out
new file mode 100644
index 000000000..2f109ef38
--- /dev/null
+++ b/tests/specs/test/package_json_basic_auto_install/test.out
@@ -0,0 +1,9 @@
+Download http://localhost:4260/@denotest/esm-basic
+Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
+Initialize @denotest/esm-basic@1.0.0
+Check file://[WILDCARD]/lib.test.ts
+running 1 test from [WILDCARD]lib.test.ts
+should add ... ok ([WILDCARD])
+
+ok | 1 passed | 0 failed ([WILDCARD])
+