summaryrefslogtreecommitdiff
path: root/tests/specs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-07-03 20:54:33 -0400
committerGitHub <noreply@github.com>2024-07-04 00:54:33 +0000
commit147411e64b22fe74cb258125acab83f9182c9f81 (patch)
treea1f63dcbf0404c20534986b10f02b649df5a3ad5 /tests/specs
parentdd6d19e12051fac2ea5639f621501f4710a1b8e1 (diff)
feat: npm workspace and better Deno workspace support (#24334)
Adds much better support for the unstable Deno workspaces as well as support for npm workspaces. npm workspaces is still lacking in that we only install packages into the root node_modules folder. We'll make it smarter over time in order for it to figure out when to add node_modules folders within packages. This includes a breaking change in config file resolution where we stop searching for config files on the first found package.json unless it's in a workspace. For the previous behaviour, the root deno.json needs to be updated to be a workspace by adding `"workspace": ["./path-to-pkg-json-folder-goes-here"]`. See details in https://github.com/denoland/deno_config/pull/66 Closes #24340 Closes #24159 Closes #24161 Closes #22020 Closes #18546 Closes #16106 Closes #24160
Diffstat (limited to 'tests/specs')
-rw-r--r--tests/specs/bench/workspace/__test__.jsonc13
-rw-r--r--tests/specs/bench/workspace/deno.json6
-rw-r--r--tests/specs/bench/workspace/package-a/deno.json5
-rw-r--r--tests/specs/bench/workspace/package-a/mod.bench.ts7
-rw-r--r--tests/specs/bench/workspace/package-a/mod.ts3
-rw-r--r--tests/specs/bench/workspace/package-b/deno.json5
-rw-r--r--tests/specs/bench/workspace/package-b/mod.bench.ts7
-rw-r--r--tests/specs/bench/workspace/package-b/mod.ts5
-rw-r--r--tests/specs/bench/workspace/package_b.out9
-rw-r--r--tests/specs/bench/workspace/root.out16
-rw-r--r--tests/specs/check/workspace/__test__.jsonc22
-rw-r--r--tests/specs/check/workspace/deno.json6
-rw-r--r--tests/specs/check/workspace/package-a/deno.json5
-rw-r--r--tests/specs/check/workspace/package-a/mod.ts3
-rw-r--r--tests/specs/check/workspace/package-b/deno.json5
-rw-r--r--tests/specs/check/workspace/package-b/mod.ts4
-rw-r--r--tests/specs/check/workspace/package_a.out1
-rw-r--r--tests/specs/check/workspace/package_b.out5
-rw-r--r--tests/specs/check/workspace/root.out6
-rw-r--r--tests/specs/compile/npmrc_auto_install/.npmrc (renamed from tests/specs/compile/npmrc/.npmrc)0
-rw-r--r--tests/specs/compile/npmrc_auto_install/__test__.jsonc22
-rw-r--r--tests/specs/compile/npmrc_auto_install/deno.json3
-rw-r--r--tests/specs/compile/npmrc_auto_install/main.js (renamed from tests/specs/compile/npmrc/main.js)0
-rw-r--r--tests/specs/compile/npmrc_auto_install/main.out (renamed from tests/specs/compile/npmrc/main.out)0
-rw-r--r--tests/specs/compile/npmrc_auto_install/package.json (renamed from tests/specs/compile/npmrc/package.json)0
-rw-r--r--tests/specs/compile/npmrc_byonm/.npmrc4
-rw-r--r--tests/specs/compile/npmrc_byonm/__test__.jsonc (renamed from tests/specs/compile/npmrc/__test__.jsonc)0
-rw-r--r--tests/specs/compile/npmrc_byonm/install.out (renamed from tests/specs/compile/npmrc/install.out)0
-rw-r--r--tests/specs/compile/npmrc_byonm/main.js8
-rw-r--r--tests/specs/compile/npmrc_byonm/main.out3
-rw-r--r--tests/specs/compile/npmrc_byonm/package.json8
-rw-r--r--tests/specs/fmt/workspace/__test__.jsonc26
-rw-r--r--tests/specs/fmt/workspace/a/a.ts1
-rw-r--r--tests/specs/fmt/workspace/a/deno.json5
-rw-r--r--tests/specs/fmt/workspace/a_check.out6
-rw-r--r--tests/specs/fmt/workspace/a_fmt.out2
-rw-r--r--tests/specs/fmt/workspace/b/b.ts1
-rw-r--r--tests/specs/fmt/workspace/b/deno.json5
-rw-r--r--tests/specs/fmt/workspace/deno.json9
-rw-r--r--tests/specs/fmt/workspace/root.ts1
-rw-r--r--tests/specs/fmt/workspace/root_check.out16
-rw-r--r--tests/specs/fmt/workspace/root_fmt.out4
-rw-r--r--tests/specs/install/future_install_global/__test__.jsonc2
-rw-r--r--tests/specs/install/future_install_global/install.out1
-rw-r--r--tests/specs/install/future_install_global/main.js3
-rw-r--r--tests/specs/install/future_install_global/pkg/main.js (renamed from tests/specs/install/no_future_install_global/main.js)0
-rw-r--r--tests/specs/install/future_install_global/pkg/package.json (renamed from tests/specs/install/future_install_global/package.json)1
-rw-r--r--tests/specs/install/no_future_install_global/__test__.jsonc2
-rw-r--r--tests/specs/install/no_future_install_global/install.out1
-rw-r--r--tests/specs/install/no_future_install_global/pkg/main.js3
-rw-r--r--tests/specs/install/no_future_install_global/pkg/package.json (renamed from tests/specs/install/no_future_install_global/package.json)0
-rw-r--r--tests/specs/lint/no_slow_types_workspace/deno.json2
-rw-r--r--tests/specs/lint/workspace/__test__.jsonc15
-rw-r--r--tests/specs/lint/workspace/a.out32
-rw-r--r--tests/specs/lint/workspace/deno.json11
-rw-r--r--tests/specs/lint/workspace/package-a/a.ts11
-rw-r--r--tests/specs/lint/workspace/package-a/deno.json12
-rw-r--r--tests/specs/lint/workspace/package-b/b.ts11
-rw-r--r--tests/specs/lint/workspace/package-b/deno.json9
-rw-r--r--tests/specs/lint/workspace/root.out82
-rw-r--r--tests/specs/lint/workspace/root.ts11
-rw-r--r--tests/specs/lint/workspace_no_slow_types/__test__.jsonc27
-rw-r--r--tests/specs/lint/workspace_no_slow_types/a.out14
-rw-r--r--tests/specs/lint/workspace_no_slow_types/a/a.ts3
-rw-r--r--tests/specs/lint/workspace_no_slow_types/a/deno.json5
-rw-r--r--tests/specs/lint/workspace_no_slow_types/b.out14
-rw-r--r--tests/specs/lint/workspace_no_slow_types/b/b.ts9
-rw-r--r--tests/specs/lint/workspace_no_slow_types/b/deno.json5
-rw-r--r--tests/specs/lint/workspace_no_slow_types/c/c.ts6
-rw-r--r--tests/specs/lint/workspace_no_slow_types/c/deno.json5
-rw-r--r--tests/specs/lint/workspace_no_slow_types/deno.json7
-rw-r--r--tests/specs/lint/workspace_no_slow_types/root.out26
-rw-r--r--tests/specs/npm/check_prefers_non_types_node_pkg/__test__.jsonc31
-rw-r--r--tests/specs/npm/check_prefers_non_types_node_pkg/expected.out4
-rw-r--r--tests/specs/npm/check_prefers_non_types_node_pkg/main.ts4
-rw-r--r--tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/@types/lz-string/package.json12
-rw-r--r--tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/lz-string/index.d.ts1
-rw-r--r--tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/lz-string/index.js1
-rw-r--r--tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/lz-string/package.json4
-rw-r--r--tests/specs/npm/check_prefers_non_types_node_pkg/package.json4
-rw-r--r--tests/specs/npm/check_types_in_types_pkg/__test__.jsonc28
-rw-r--r--tests/specs/npm/check_types_in_types_pkg/expected.out4
-rw-r--r--tests/specs/npm/check_types_in_types_pkg/main.ts5
-rw-r--r--tests/specs/npm/check_types_in_types_pkg/main_auto_install.ts6
-rw-r--r--tests/specs/npm/check_types_in_types_pkg/package.json6
-rw-r--r--tests/specs/npm/workspace_basic/__test__.jsonc35
-rw-r--r--tests/specs/npm/workspace_basic/a/mod.ts6
-rw-r--r--tests/specs/npm/workspace_basic/a/package.json10
-rw-r--r--tests/specs/npm/workspace_basic/b/exports-sub-path-not-exists.out2
-rw-r--r--tests/specs/npm/workspace_basic/b/exports-sub-path-not-exists.ts2
-rw-r--r--tests/specs/npm/workspace_basic/b/main.ts9
-rw-r--r--tests/specs/npm/workspace_basic/b/main_byonm.out4
-rw-r--r--tests/specs/npm/workspace_basic/b/main_global_cache.out6
-rw-r--r--tests/specs/npm/workspace_basic/b/main_node_modules_dir.out7
-rw-r--r--tests/specs/npm/workspace_basic/b/no-exports-sub-path-not-exists.out3
-rw-r--r--tests/specs/npm/workspace_basic/b/no-exports-sub-path-not-exists.ts2
-rw-r--r--tests/specs/npm/workspace_basic/b/package.json8
-rw-r--r--tests/specs/npm/workspace_basic/c/index.js3
-rw-r--r--tests/specs/npm/workspace_basic/c/package.json4
-rw-r--r--tests/specs/npm/workspace_basic/package.json7
-rw-r--r--tests/specs/publish/byonm_dep/publish.out4
-rw-r--r--tests/specs/publish/workspace/__test__.jsonc19
-rw-r--r--tests/specs/publish/workspace/deno.json2
-rw-r--r--tests/specs/publish/workspace/workspace.out8
-rw-r--r--tests/specs/publish/workspace/workspace_individual.out4
-rw-r--r--tests/specs/run/no_deno_json/__test__.jsonc71
-rw-r--r--tests/specs/run/no_deno_json/no_package_json.out4
-rw-r--r--tests/specs/run/no_deno_json/noconfig.out1
-rw-r--r--tests/specs/run/workspaces/basic/deno.json2
-rw-r--r--tests/specs/run/workspaces/basic/main.out14
-rw-r--r--tests/specs/run/workspaces/member_outside_root_dir/__test__.jsonc2
-rw-r--r--tests/specs/run/workspaces/member_outside_root_dir/main.out4
-rw-r--r--tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/deno.json (renamed from tests/specs/run/workspaces/member_outside_root_dir/deno.json)2
-rw-r--r--tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/bar/hello.ts (renamed from tests/specs/run/workspaces/member_outside_root_dir/foo/bar/hello.ts)0
-rw-r--r--tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/deno.json (renamed from tests/specs/run/workspaces/member_outside_root_dir/foo/deno.json)0
-rw-r--r--tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/fizz/buzz.ts (renamed from tests/specs/run/workspaces/member_outside_root_dir/foo/fizz/buzz.ts)0
-rw-r--r--tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/mod.ts (renamed from tests/specs/run/workspaces/member_outside_root_dir/foo/mod.ts)0
-rw-r--r--tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/main.ts (renamed from tests/specs/run/workspaces/member_outside_root_dir/main.ts)0
-rw-r--r--tests/specs/run/workspaces/members_are_imports/deno.json2
-rw-r--r--tests/specs/run/workspaces/nested_member/__test__.jsonc2
-rw-r--r--tests/specs/run/workspaces/nested_member/bar/deno.json3
-rw-r--r--tests/specs/run/workspaces/nested_member/deno.json2
-rw-r--r--tests/specs/run/workspaces/nested_member/foo/bar/deno.json3
-rw-r--r--tests/specs/run/workspaces/nested_member/foo/deno.json3
-rw-r--r--tests/specs/run/workspaces/nested_member/main.out5
-rw-r--r--tests/specs/task/workspace/__test__.jsonc52
-rw-r--r--tests/specs/task/workspace/deno.json9
-rw-r--r--tests/specs/task/workspace/package-a.out9
-rw-r--r--tests/specs/task/workspace/package-a/deno.json5
-rw-r--r--tests/specs/task/workspace/package-b.out11
-rw-r--r--tests/specs/task/workspace/package-b/deno.json6
-rw-r--r--tests/specs/task/workspace/package-b/package.json6
-rw-r--r--tests/specs/task/workspace/package.json6
-rw-r--r--tests/specs/task/workspace/root.out7
-rw-r--r--tests/specs/task/workspace/scripts.out7
-rw-r--r--tests/specs/task/workspace/scripts/main.ts1
-rw-r--r--tests/specs/test/workspace/__test__.jsonc20
-rw-r--r--tests/specs/test/workspace/deno.json6
-rw-r--r--tests/specs/test/workspace/package-a/deno.json5
-rw-r--r--tests/specs/test/workspace/package-a/mod.test.ts7
-rw-r--r--tests/specs/test/workspace/package-a/mod.ts3
-rw-r--r--tests/specs/test/workspace/package-b/deno.json5
-rw-r--r--tests/specs/test/workspace/package-b/mod.test.ts11
-rw-r--r--tests/specs/test/workspace/package-b/mod.ts5
-rw-r--r--tests/specs/test/workspace/package_a.out6
-rw-r--r--tests/specs/test/workspace/package_b.out20
-rw-r--r--tests/specs/test/workspace/root.out23
-rw-r--r--tests/specs/workspaces/lockfile/__test__.jsonc24
-rw-r--r--tests/specs/workspaces/lockfile/deno.json6
-rw-r--r--tests/specs/workspaces/lockfile/expected-lock.out24
-rw-r--r--tests/specs/workspaces/lockfile/integration.test.ts7
-rw-r--r--tests/specs/workspaces/lockfile/pkg-no-deps/deno.jsonc7
-rw-r--r--tests/specs/workspaces/lockfile/pkg-no-deps/mod.ts0
-rw-r--r--tests/specs/workspaces/lockfile/pkg/deno.jsonc8
-rw-r--r--tests/specs/workspaces/lockfile/pkg/mod.test.ts7
-rw-r--r--tests/specs/workspaces/lockfile/pkg/mod.ts5
-rw-r--r--tests/specs/workspaces/lockfile/test_pkg.out9
-rw-r--r--tests/specs/workspaces/lockfile/test_root.out9
-rw-r--r--tests/specs/workspaces/non_fatal_diagnostics/__test__.jsonc13
-rw-r--r--tests/specs/workspaces/non_fatal_diagnostics/deno.json5
-rw-r--r--tests/specs/workspaces/non_fatal_diagnostics/lint.out5
-rw-r--r--tests/specs/workspaces/non_fatal_diagnostics/sub/deno.json8
-rw-r--r--tests/specs/workspaces/non_fatal_diagnostics/sub/main.ts0
-rw-r--r--tests/specs/workspaces/vendor/__test__.jsonc13
-rw-r--r--tests/specs/workspaces/vendor/deno.json9
-rw-r--r--tests/specs/workspaces/vendor/modify_vendor.ts7
-rw-r--r--tests/specs/workspaces/vendor/package-a/deno.json5
-rw-r--r--tests/specs/workspaces/vendor/package-a/mod.ts3
168 files changed, 1264 insertions, 102 deletions
diff --git a/tests/specs/bench/workspace/__test__.jsonc b/tests/specs/bench/workspace/__test__.jsonc
new file mode 100644
index 000000000..fa1bd69da
--- /dev/null
+++ b/tests/specs/bench/workspace/__test__.jsonc
@@ -0,0 +1,13 @@
+{
+ "tests": {
+ "root": {
+ "args": "bench",
+ "output": "root.out"
+ },
+ "package": {
+ "args": "bench",
+ "cwd": "package-b",
+ "output": "package_b.out"
+ }
+ }
+}
diff --git a/tests/specs/bench/workspace/deno.json b/tests/specs/bench/workspace/deno.json
new file mode 100644
index 000000000..b72d88442
--- /dev/null
+++ b/tests/specs/bench/workspace/deno.json
@@ -0,0 +1,6 @@
+{
+ "workspace": [
+ "./package-a",
+ "./package-b"
+ ]
+}
diff --git a/tests/specs/bench/workspace/package-a/deno.json b/tests/specs/bench/workspace/package-a/deno.json
new file mode 100644
index 000000000..e6e03ae85
--- /dev/null
+++ b/tests/specs/bench/workspace/package-a/deno.json
@@ -0,0 +1,5 @@
+{
+ "name": "@scope/a",
+ "version": "1.0.0",
+ "exports": "./mod.ts"
+}
diff --git a/tests/specs/bench/workspace/package-a/mod.bench.ts b/tests/specs/bench/workspace/package-a/mod.bench.ts
new file mode 100644
index 000000000..5fbf79e66
--- /dev/null
+++ b/tests/specs/bench/workspace/package-a/mod.bench.ts
@@ -0,0 +1,7 @@
+import { add } from "./mod.ts";
+
+Deno.bench("add", () => {
+ if (add(1, 2) !== 3) {
+ throw new Error("failed");
+ }
+});
diff --git a/tests/specs/bench/workspace/package-a/mod.ts b/tests/specs/bench/workspace/package-a/mod.ts
new file mode 100644
index 000000000..8d9b8a22a
--- /dev/null
+++ b/tests/specs/bench/workspace/package-a/mod.ts
@@ -0,0 +1,3 @@
+export function add(a: number, b: number): number {
+ return a + b;
+}
diff --git a/tests/specs/bench/workspace/package-b/deno.json b/tests/specs/bench/workspace/package-b/deno.json
new file mode 100644
index 000000000..f131c191b
--- /dev/null
+++ b/tests/specs/bench/workspace/package-b/deno.json
@@ -0,0 +1,5 @@
+{
+ "name": "@scope/b",
+ "version": "1.0.0",
+ "exports": "./mod.ts"
+}
diff --git a/tests/specs/bench/workspace/package-b/mod.bench.ts b/tests/specs/bench/workspace/package-b/mod.bench.ts
new file mode 100644
index 000000000..ca972c39e
--- /dev/null
+++ b/tests/specs/bench/workspace/package-b/mod.bench.ts
@@ -0,0 +1,7 @@
+import { addOne } from "./mod.ts";
+
+Deno.bench("addOne", () => {
+ if (addOne(1) !== 2) {
+ throw new Error("failed");
+ }
+});
diff --git a/tests/specs/bench/workspace/package-b/mod.ts b/tests/specs/bench/workspace/package-b/mod.ts
new file mode 100644
index 000000000..53148ac2f
--- /dev/null
+++ b/tests/specs/bench/workspace/package-b/mod.ts
@@ -0,0 +1,5 @@
+import { add } from "@scope/a";
+
+export function addOne(a: number): number {
+ return add(a, 1);
+}
diff --git a/tests/specs/bench/workspace/package_b.out b/tests/specs/bench/workspace/package_b.out
new file mode 100644
index 000000000..bb452e3e9
--- /dev/null
+++ b/tests/specs/bench/workspace/package_b.out
@@ -0,0 +1,9 @@
+Check file:///[WILDLINE]/package-b/mod.bench.ts
+cpu: [WILDLINE]
+runtime: [WILDLINE]
+
+file:///[WILDLINE]/package-b/mod.bench.ts
+benchmark[WILDLINE]
+---[WILDLINE]
+addOne[WILDLINE]
+
diff --git a/tests/specs/bench/workspace/root.out b/tests/specs/bench/workspace/root.out
new file mode 100644
index 000000000..897cd7d3c
--- /dev/null
+++ b/tests/specs/bench/workspace/root.out
@@ -0,0 +1,16 @@
+Check file:///[WILDLINE]/package-a/mod.bench.ts
+Check file:///[WILDLINE]/package-b/mod.bench.ts
+cpu: [WILDLINE]
+runtime: [WILDLINE]
+
+file:///[WILDLINE]/package-a/mod.bench.ts
+benchmark[WILDLINE]
+---[WILDLINE]
+add[WILDLINE]
+
+
+file:///[WILDLINE]/package-b/mod.bench.ts
+benchmark[WILDLINE]
+---[WILDLINE]
+addOne[WILDLINE]
+
diff --git a/tests/specs/check/workspace/__test__.jsonc b/tests/specs/check/workspace/__test__.jsonc
new file mode 100644
index 000000000..5df2fd70e
--- /dev/null
+++ b/tests/specs/check/workspace/__test__.jsonc
@@ -0,0 +1,22 @@
+{
+ "tests": {
+ "root": {
+ // todo(dsherret): should be possible to not provide args here
+ "args": "check package-a/mod.ts package-b/mod.ts",
+ "output": "root.out",
+ "exitCode": 1
+ },
+ "package_a": {
+ "args": "check mod.ts",
+ "cwd": "package-a",
+ "output": "package_a.out",
+ "exitCode": 0
+ },
+ "package_b": {
+ "args": "check mod.ts",
+ "cwd": "package-b",
+ "output": "package_b.out",
+ "exitCode": 1
+ }
+ }
+}
diff --git a/tests/specs/check/workspace/deno.json b/tests/specs/check/workspace/deno.json
new file mode 100644
index 000000000..b72d88442
--- /dev/null
+++ b/tests/specs/check/workspace/deno.json
@@ -0,0 +1,6 @@
+{
+ "workspace": [
+ "./package-a",
+ "./package-b"
+ ]
+}
diff --git a/tests/specs/check/workspace/package-a/deno.json b/tests/specs/check/workspace/package-a/deno.json
new file mode 100644
index 000000000..e6e03ae85
--- /dev/null
+++ b/tests/specs/check/workspace/package-a/deno.json
@@ -0,0 +1,5 @@
+{
+ "name": "@scope/a",
+ "version": "1.0.0",
+ "exports": "./mod.ts"
+}
diff --git a/tests/specs/check/workspace/package-a/mod.ts b/tests/specs/check/workspace/package-a/mod.ts
new file mode 100644
index 000000000..8d9b8a22a
--- /dev/null
+++ b/tests/specs/check/workspace/package-a/mod.ts
@@ -0,0 +1,3 @@
+export function add(a: number, b: number): number {
+ return a + b;
+}
diff --git a/tests/specs/check/workspace/package-b/deno.json b/tests/specs/check/workspace/package-b/deno.json
new file mode 100644
index 000000000..f131c191b
--- /dev/null
+++ b/tests/specs/check/workspace/package-b/deno.json
@@ -0,0 +1,5 @@
+{
+ "name": "@scope/b",
+ "version": "1.0.0",
+ "exports": "./mod.ts"
+}
diff --git a/tests/specs/check/workspace/package-b/mod.ts b/tests/specs/check/workspace/package-b/mod.ts
new file mode 100644
index 000000000..554ba5674
--- /dev/null
+++ b/tests/specs/check/workspace/package-b/mod.ts
@@ -0,0 +1,4 @@
+import { add } from "@scope/a";
+
+const test: string = add(1, 2);
+console.log(test);
diff --git a/tests/specs/check/workspace/package_a.out b/tests/specs/check/workspace/package_a.out
new file mode 100644
index 000000000..faecec870
--- /dev/null
+++ b/tests/specs/check/workspace/package_a.out
@@ -0,0 +1 @@
+Check file:///[WILDLINE]/package-a/mod.ts
diff --git a/tests/specs/check/workspace/package_b.out b/tests/specs/check/workspace/package_b.out
new file mode 100644
index 000000000..8db6c5476
--- /dev/null
+++ b/tests/specs/check/workspace/package_b.out
@@ -0,0 +1,5 @@
+Check file:///[WILDLINE]/package-b/mod.ts
+error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
+const test: string = add(1, 2);
+ ~~~~
+ at [WILDLINE]
diff --git a/tests/specs/check/workspace/root.out b/tests/specs/check/workspace/root.out
new file mode 100644
index 000000000..21ae7acd3
--- /dev/null
+++ b/tests/specs/check/workspace/root.out
@@ -0,0 +1,6 @@
+Check file:///[WILDLINE]/package-a/mod.ts
+Check file:///[WILDLINE]/package-b/mod.ts
+error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'.
+const test: string = add(1, 2);
+ ~~~~
+ at [WILDLINE]
diff --git a/tests/specs/compile/npmrc/.npmrc b/tests/specs/compile/npmrc_auto_install/.npmrc
index 13552ad61..13552ad61 100644
--- a/tests/specs/compile/npmrc/.npmrc
+++ b/tests/specs/compile/npmrc_auto_install/.npmrc
diff --git a/tests/specs/compile/npmrc_auto_install/__test__.jsonc b/tests/specs/compile/npmrc_auto_install/__test__.jsonc
new file mode 100644
index 000000000..f4ba8ee28
--- /dev/null
+++ b/tests/specs/compile/npmrc_auto_install/__test__.jsonc
@@ -0,0 +1,22 @@
+{
+ "tempDir": true,
+ "steps": [{
+ "if": "unix",
+ "args": "compile --output main main.js",
+ "output": "[WILDCARD]"
+ }, {
+ "if": "unix",
+ "commandName": "./main",
+ "args": [],
+ "output": "main.out"
+ }, {
+ "if": "windows",
+ "args": "compile --output main.exe main.js",
+ "output": "[WILDCARD]"
+ }, {
+ "if": "windows",
+ "commandName": "./main.exe",
+ "args": [],
+ "output": "main.out"
+ }]
+}
diff --git a/tests/specs/compile/npmrc_auto_install/deno.json b/tests/specs/compile/npmrc_auto_install/deno.json
new file mode 100644
index 000000000..176354f98
--- /dev/null
+++ b/tests/specs/compile/npmrc_auto_install/deno.json
@@ -0,0 +1,3 @@
+{
+ "nodeModulesDir": true
+}
diff --git a/tests/specs/compile/npmrc/main.js b/tests/specs/compile/npmrc_auto_install/main.js
index 66b393636..66b393636 100644
--- a/tests/specs/compile/npmrc/main.js
+++ b/tests/specs/compile/npmrc_auto_install/main.js
diff --git a/tests/specs/compile/npmrc/main.out b/tests/specs/compile/npmrc_auto_install/main.out
index bbe210bdb..bbe210bdb 100644
--- a/tests/specs/compile/npmrc/main.out
+++ b/tests/specs/compile/npmrc_auto_install/main.out
diff --git a/tests/specs/compile/npmrc/package.json b/tests/specs/compile/npmrc_auto_install/package.json
index 274d1ed7f..274d1ed7f 100644
--- a/tests/specs/compile/npmrc/package.json
+++ b/tests/specs/compile/npmrc_auto_install/package.json
diff --git a/tests/specs/compile/npmrc_byonm/.npmrc b/tests/specs/compile/npmrc_byonm/.npmrc
new file mode 100644
index 000000000..13552ad61
--- /dev/null
+++ b/tests/specs/compile/npmrc_byonm/.npmrc
@@ -0,0 +1,4 @@
+@denotest:registry=http://localhost:4261/
+//localhost:4261/:_authToken=private-reg-token
+@denotest2:registry=http://localhost:4262/
+//localhost:4262/:_authToken=private-reg-token2
diff --git a/tests/specs/compile/npmrc/__test__.jsonc b/tests/specs/compile/npmrc_byonm/__test__.jsonc
index 470e5299c..470e5299c 100644
--- a/tests/specs/compile/npmrc/__test__.jsonc
+++ b/tests/specs/compile/npmrc_byonm/__test__.jsonc
diff --git a/tests/specs/compile/npmrc/install.out b/tests/specs/compile/npmrc_byonm/install.out
index 5c2ff3562..5c2ff3562 100644
--- a/tests/specs/compile/npmrc/install.out
+++ b/tests/specs/compile/npmrc_byonm/install.out
diff --git a/tests/specs/compile/npmrc_byonm/main.js b/tests/specs/compile/npmrc_byonm/main.js
new file mode 100644
index 000000000..66b393636
--- /dev/null
+++ b/tests/specs/compile/npmrc_byonm/main.js
@@ -0,0 +1,8 @@
+import { getValue, setValue } from "@denotest/basic";
+import * as test from "@denotest2/basic";
+
+console.log(getValue());
+setValue(42);
+console.log(getValue());
+
+console.log(test.getValue());
diff --git a/tests/specs/compile/npmrc_byonm/main.out b/tests/specs/compile/npmrc_byonm/main.out
new file mode 100644
index 000000000..bbe210bdb
--- /dev/null
+++ b/tests/specs/compile/npmrc_byonm/main.out
@@ -0,0 +1,3 @@
+0
+42
+0
diff --git a/tests/specs/compile/npmrc_byonm/package.json b/tests/specs/compile/npmrc_byonm/package.json
new file mode 100644
index 000000000..274d1ed7f
--- /dev/null
+++ b/tests/specs/compile/npmrc_byonm/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "npmrc_test",
+ "version": "0.0.1",
+ "dependencies": {
+ "@denotest/basic": "1.0.0",
+ "@denotest2/basic": "1.0.0"
+ }
+}
diff --git a/tests/specs/fmt/workspace/__test__.jsonc b/tests/specs/fmt/workspace/__test__.jsonc
new file mode 100644
index 000000000..80e3639f9
--- /dev/null
+++ b/tests/specs/fmt/workspace/__test__.jsonc
@@ -0,0 +1,26 @@
+{
+ "tests": {
+ "root_fmt": {
+ "tempDir": true,
+ "args": "fmt",
+ "output": "root_fmt.out"
+ },
+ "root_check": {
+ "args": "fmt --check",
+ "exitCode": 1,
+ "output": "root_check.out"
+ },
+ "sub_dir_fmt": {
+ "tempDir": true,
+ "args": "fmt",
+ "cwd": "a",
+ "output": "a_fmt.out"
+ },
+ "subdir_check": {
+ "args": "fmt --check",
+ "cwd": "a",
+ "exitCode": 1,
+ "output": "a_check.out"
+ }
+ }
+}
diff --git a/tests/specs/fmt/workspace/a/a.ts b/tests/specs/fmt/workspace/a/a.ts
new file mode 100644
index 000000000..7b2a34601
--- /dev/null
+++ b/tests/specs/fmt/workspace/a/a.ts
@@ -0,0 +1 @@
+console.log("a");
diff --git a/tests/specs/fmt/workspace/a/deno.json b/tests/specs/fmt/workspace/a/deno.json
new file mode 100644
index 000000000..0dd8856d7
--- /dev/null
+++ b/tests/specs/fmt/workspace/a/deno.json
@@ -0,0 +1,5 @@
+{
+ "fmt": {
+ "semiColons": false
+ }
+}
diff --git a/tests/specs/fmt/workspace/a_check.out b/tests/specs/fmt/workspace/a_check.out
new file mode 100644
index 000000000..150f18b2e
--- /dev/null
+++ b/tests/specs/fmt/workspace/a_check.out
@@ -0,0 +1,6 @@
+
+from [WILDLINE]a.ts:
+1 | -console.log("a");
+1 | +console.log('a')
+
+error: Found 1 not formatted file in 2 files
diff --git a/tests/specs/fmt/workspace/a_fmt.out b/tests/specs/fmt/workspace/a_fmt.out
new file mode 100644
index 000000000..18da23175
--- /dev/null
+++ b/tests/specs/fmt/workspace/a_fmt.out
@@ -0,0 +1,2 @@
+[WILDLINE]a.ts
+Checked 2 files
diff --git a/tests/specs/fmt/workspace/b/b.ts b/tests/specs/fmt/workspace/b/b.ts
new file mode 100644
index 000000000..8609d0755
--- /dev/null
+++ b/tests/specs/fmt/workspace/b/b.ts
@@ -0,0 +1 @@
+console.log('a');
diff --git a/tests/specs/fmt/workspace/b/deno.json b/tests/specs/fmt/workspace/b/deno.json
new file mode 100644
index 000000000..388b14749
--- /dev/null
+++ b/tests/specs/fmt/workspace/b/deno.json
@@ -0,0 +1,5 @@
+{
+ "fmt": {
+ "singleQuote": false
+ }
+}
diff --git a/tests/specs/fmt/workspace/deno.json b/tests/specs/fmt/workspace/deno.json
new file mode 100644
index 000000000..2b030605d
--- /dev/null
+++ b/tests/specs/fmt/workspace/deno.json
@@ -0,0 +1,9 @@
+{
+ "workspace": [
+ "./a",
+ "./b"
+ ],
+ "fmt": {
+ "singleQuote": true
+ }
+}
diff --git a/tests/specs/fmt/workspace/root.ts b/tests/specs/fmt/workspace/root.ts
new file mode 100644
index 000000000..9300c8169
--- /dev/null
+++ b/tests/specs/fmt/workspace/root.ts
@@ -0,0 +1 @@
+console.log("root")
diff --git a/tests/specs/fmt/workspace/root_check.out b/tests/specs/fmt/workspace/root_check.out
new file mode 100644
index 000000000..323f43f34
--- /dev/null
+++ b/tests/specs/fmt/workspace/root_check.out
@@ -0,0 +1,16 @@
+
+from [WILDLINE]root.ts:
+1 | -console.log("root")
+1 | +console.log('root');
+
+
+from [WILDLINE]workspace[WILDCHAR]a[WILDCHAR]a.ts:
+1 | -console.log("a");
+1 | +console.log('a')
+
+
+from [WILDLINE]workspace[WILDCHAR]b[WILDCHAR]b.ts:
+1 | -console.log('a');
+1 | +console.log("a");
+
+error: Found 3 not formatted files in 7 files
diff --git a/tests/specs/fmt/workspace/root_fmt.out b/tests/specs/fmt/workspace/root_fmt.out
new file mode 100644
index 000000000..306ecada6
--- /dev/null
+++ b/tests/specs/fmt/workspace/root_fmt.out
@@ -0,0 +1,4 @@
+[WILDLINE]root.ts
+[WILDLINE]a.ts
+[WILDLINE]b.ts
+Checked 6 files
diff --git a/tests/specs/install/future_install_global/__test__.jsonc b/tests/specs/install/future_install_global/__test__.jsonc
index be6fcab97..e646164c6 100644
--- a/tests/specs/install/future_install_global/__test__.jsonc
+++ b/tests/specs/install/future_install_global/__test__.jsonc
@@ -5,7 +5,7 @@
},
"steps": [
{
- "args": "install --global --root ./bins --name deno-test-bin ./main.js",
+ "args": "install --global --root ./bins --name deno-test-bin ./pkg/main.js",
"output": "install.out"
},
{
diff --git a/tests/specs/install/future_install_global/install.out b/tests/specs/install/future_install_global/install.out
index adb8b4598..58cd88ada 100644
--- a/tests/specs/install/future_install_global/install.out
+++ b/tests/specs/install/future_install_global/install.out
@@ -1,5 +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
✅ Successfully installed deno-test-bin[WILDCARD]
[WILDCARD]
diff --git a/tests/specs/install/future_install_global/main.js b/tests/specs/install/future_install_global/main.js
deleted file mode 100644
index 2ba55540b..000000000
--- a/tests/specs/install/future_install_global/main.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import { setValue } from "@denotest/esm-basic";
-
-setValue(5);
diff --git a/tests/specs/install/no_future_install_global/main.js b/tests/specs/install/future_install_global/pkg/main.js
index 6268d7136..6268d7136 100644
--- a/tests/specs/install/no_future_install_global/main.js
+++ b/tests/specs/install/future_install_global/pkg/main.js
diff --git a/tests/specs/install/future_install_global/package.json b/tests/specs/install/future_install_global/pkg/package.json
index f3b6cb7be..57493f556 100644
--- a/tests/specs/install/future_install_global/package.json
+++ b/tests/specs/install/future_install_global/pkg/package.json
@@ -1,7 +1,6 @@
{
"name": "deno-test-bin",
"dependencies": {
- "@denotest/esm-basic": "*"
},
"type": "module"
}
diff --git a/tests/specs/install/no_future_install_global/__test__.jsonc b/tests/specs/install/no_future_install_global/__test__.jsonc
index ca351ee0d..657cdab80 100644
--- a/tests/specs/install/no_future_install_global/__test__.jsonc
+++ b/tests/specs/install/no_future_install_global/__test__.jsonc
@@ -2,7 +2,7 @@
"tempDir": true,
"steps": [
{
- "args": "install --root ./bins --name deno-test-bin ./main.js",
+ "args": "install --root ./bins --name deno-test-bin ./pkg/main.js",
"output": "install.out"
},
{
diff --git a/tests/specs/install/no_future_install_global/install.out b/tests/specs/install/no_future_install_global/install.out
index f3a394c6f..b1933f536 100644
--- a/tests/specs/install/no_future_install_global/install.out
+++ b/tests/specs/install/no_future_install_global/install.out
@@ -1,5 +1,6 @@
⚠️ `deno install` behavior will change in Deno 2. To preserve the current behavior use the `-g` or `--global` flag.
Download http://localhost:4260/@denotest/esm-basic
Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
+[# there shouldn't be a line saying it initialized the node_modules folder here because this is a global install]
✅ Successfully installed deno-test-bin[WILDCARD]
[WILDCARD]
diff --git a/tests/specs/install/no_future_install_global/pkg/main.js b/tests/specs/install/no_future_install_global/pkg/main.js
new file mode 100644
index 000000000..6268d7136
--- /dev/null
+++ b/tests/specs/install/no_future_install_global/pkg/main.js
@@ -0,0 +1,3 @@
+import { setValue } from "npm:@denotest/esm-basic";
+
+setValue(5);
diff --git a/tests/specs/install/no_future_install_global/package.json b/tests/specs/install/no_future_install_global/pkg/package.json
index 9f465ad50..9f465ad50 100644
--- a/tests/specs/install/no_future_install_global/package.json
+++ b/tests/specs/install/no_future_install_global/pkg/package.json
diff --git a/tests/specs/lint/no_slow_types_workspace/deno.json b/tests/specs/lint/no_slow_types_workspace/deno.json
index e3dd981e5..499731c1e 100644
--- a/tests/specs/lint/no_slow_types_workspace/deno.json
+++ b/tests/specs/lint/no_slow_types_workspace/deno.json
@@ -1,5 +1,5 @@
{
- "workspaces": [
+ "workspace": [
"./a",
"./b",
"./c"
diff --git a/tests/specs/lint/workspace/__test__.jsonc b/tests/specs/lint/workspace/__test__.jsonc
new file mode 100644
index 000000000..6581222c9
--- /dev/null
+++ b/tests/specs/lint/workspace/__test__.jsonc
@@ -0,0 +1,15 @@
+{
+ "tests": {
+ "root": {
+ "args": "lint",
+ "exitCode": 1,
+ "output": "root.out"
+ },
+ "subdir": {
+ "args": "lint",
+ "cwd": "package-a",
+ "exitCode": 1,
+ "output": "a.out"
+ }
+ }
+}
diff --git a/tests/specs/lint/workspace/a.out b/tests/specs/lint/workspace/a.out
new file mode 100644
index 000000000..52f05af99
--- /dev/null
+++ b/tests/specs/lint/workspace/a.out
@@ -0,0 +1,32 @@
+error[no-eval]: `eval` call is not allowed
+ --> [WILDLINE]a.ts:1:1
+ |
+1 | eval("");
+ | ^^^^^^^^
+ = hint: Remove the use of `eval`
+
+ docs: https://lint.deno.land/rules/no-eval
+
+
+error[no-await-in-loop]: Unexpected `await` inside a loop.
+ --> [WILDLINE]a.ts:4:3
+ |
+4 | await Deno.open("test");
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ = hint: Remove `await` in loop body, store all promises generated and then `await Promise.all(storedPromises)` after the loop
+
+ docs: https://lint.deno.land/rules/no-await-in-loop
+
+
+error[no-explicit-any]: `any` type is not allowed
+ --> [WILDLINE]a.ts:9:25
+ |
+9 | export function test(): any {
+ | ^^^
+ = hint: Use a specific type other than `any`
+
+ docs: https://lint.deno.land/rules/no-explicit-any
+
+
+Found 3 problems
+Checked 1 file
diff --git a/tests/specs/lint/workspace/deno.json b/tests/specs/lint/workspace/deno.json
new file mode 100644
index 000000000..2dab3a4ec
--- /dev/null
+++ b/tests/specs/lint/workspace/deno.json
@@ -0,0 +1,11 @@
+{
+ "workspace": [
+ "./package-a",
+ "./package-b"
+ ],
+ "lint": {
+ "rules": {
+ "include": ["no-eval"]
+ }
+ }
+}
diff --git a/tests/specs/lint/workspace/package-a/a.ts b/tests/specs/lint/workspace/package-a/a.ts
new file mode 100644
index 000000000..52bd0cbc0
--- /dev/null
+++ b/tests/specs/lint/workspace/package-a/a.ts
@@ -0,0 +1,11 @@
+eval("");
+
+for (let i = 0; i < 10; i++) {
+ await Deno.open("test");
+}
+
+const unused = 1;
+
+export function test(): any {
+ return {};
+}
diff --git a/tests/specs/lint/workspace/package-a/deno.json b/tests/specs/lint/workspace/package-a/deno.json
new file mode 100644
index 000000000..34130b647
--- /dev/null
+++ b/tests/specs/lint/workspace/package-a/deno.json
@@ -0,0 +1,12 @@
+{
+ "lint": {
+ "rules": {
+ "include": [
+ "no-await-in-loop"
+ ],
+ "exclude": [
+ "no-unused-vars"
+ ]
+ }
+ }
+}
diff --git a/tests/specs/lint/workspace/package-b/b.ts b/tests/specs/lint/workspace/package-b/b.ts
new file mode 100644
index 000000000..52bd0cbc0
--- /dev/null
+++ b/tests/specs/lint/workspace/package-b/b.ts
@@ -0,0 +1,11 @@
+eval("");
+
+for (let i = 0; i < 10; i++) {
+ await Deno.open("test");
+}
+
+const unused = 1;
+
+export function test(): any {
+ return {};
+}
diff --git a/tests/specs/lint/workspace/package-b/deno.json b/tests/specs/lint/workspace/package-b/deno.json
new file mode 100644
index 000000000..93fdf6ca7
--- /dev/null
+++ b/tests/specs/lint/workspace/package-b/deno.json
@@ -0,0 +1,9 @@
+{
+ "lint": {
+ "rules": {
+ "exclude": [
+ "no-explicit-any"
+ ]
+ }
+ }
+}
diff --git a/tests/specs/lint/workspace/root.out b/tests/specs/lint/workspace/root.out
new file mode 100644
index 000000000..1d892a93f
--- /dev/null
+++ b/tests/specs/lint/workspace/root.out
@@ -0,0 +1,82 @@
+error[no-eval]: `eval` call is not allowed
+ --> [WILDLINE]root.ts:1:1
+ |
+1 | eval("");
+ | ^^^^^^^^
+ = hint: Remove the use of `eval`
+
+ docs: https://lint.deno.land/rules/no-eval
+
+
+error[no-unused-vars]: `unused` is never used
+ --> [WILDLINE]root.ts:7:7
+ |
+7 | const unused = 1;
+ | ^^^^^^
+ = hint: If this is intentional, prefix it with an underscore like `_unused`
+
+ docs: https://lint.deno.land/rules/no-unused-vars
+
+
+error[no-explicit-any]: `any` type is not allowed
+ --> [WILDLINE]root.ts:9:25
+ |
+9 | export function test(): any {
+ | ^^^
+ = hint: Use a specific type other than `any`
+
+ docs: https://lint.deno.land/rules/no-explicit-any
+
+
+error[no-eval]: `eval` call is not allowed
+ --> [WILDLINE]package-a[WILDCHAR]a.ts:1:1
+ |
+1 | eval("");
+ | ^^^^^^^^
+ = hint: Remove the use of `eval`
+
+ docs: https://lint.deno.land/rules/no-eval
+
+
+error[no-await-in-loop]: Unexpected `await` inside a loop.
+ --> [WILDLINE]package-a[WILDCHAR]a.ts:4:3
+ |
+4 | await Deno.open("test");
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ = hint: Remove `await` in loop body, store all promises generated and then `await Promise.all(storedPromises)` after the loop
+
+ docs: https://lint.deno.land/rules/no-await-in-loop
+
+
+error[no-explicit-any]: `any` type is not allowed
+ --> [WILDLINE]package-a[WILDCHAR]a.ts:9:25
+ |
+9 | export function test(): any {
+ | ^^^
+ = hint: Use a specific type other than `any`
+
+ docs: https://lint.deno.land/rules/no-explicit-any
+
+
+error[no-eval]: `eval` call is not allowed
+ --> [WILDLINE]package-b[WILDCHAR]b.ts:1:1
+ |
+1 | eval("");
+ | ^^^^^^^^
+ = hint: Remove the use of `eval`
+
+ docs: https://lint.deno.land/rules/no-eval
+
+
+error[no-unused-vars]: `unused` is never used
+ --> [WILDLINE]b.ts:7:7
+ |
+7 | const unused = 1;
+ | ^^^^^^
+ = hint: If this is intentional, prefix it with an underscore like `_unused`
+
+ docs: https://lint.deno.land/rules/no-unused-vars
+
+
+Found 8 problems
+Checked 3 files
diff --git a/tests/specs/lint/workspace/root.ts b/tests/specs/lint/workspace/root.ts
new file mode 100644
index 000000000..52bd0cbc0
--- /dev/null
+++ b/tests/specs/lint/workspace/root.ts
@@ -0,0 +1,11 @@
+eval("");
+
+for (let i = 0; i < 10; i++) {
+ await Deno.open("test");
+}
+
+const unused = 1;
+
+export function test(): any {
+ return {};
+}
diff --git a/tests/specs/lint/workspace_no_slow_types/__test__.jsonc b/tests/specs/lint/workspace_no_slow_types/__test__.jsonc
new file mode 100644
index 000000000..489ee52ab
--- /dev/null
+++ b/tests/specs/lint/workspace_no_slow_types/__test__.jsonc
@@ -0,0 +1,27 @@
+{
+ "tests": {
+ "root": {
+ "args": "lint",
+ "exitCode": 1,
+ "output": "root.out"
+ },
+ "package_a": {
+ "args": "lint",
+ "cwd": "a",
+ "exitCode": 1,
+ "output": "a.out"
+ },
+ "package_b": {
+ "args": "lint",
+ "cwd": "b",
+ "exitCode": 1,
+ "output": "b.out"
+ },
+ "package_c": {
+ "args": "lint",
+ "cwd": "c",
+ "exitCode": 0,
+ "output": "Checked 1 file\n"
+ }
+ }
+}
diff --git a/tests/specs/lint/workspace_no_slow_types/a.out b/tests/specs/lint/workspace_no_slow_types/a.out
new file mode 100644
index 000000000..12c6715be
--- /dev/null
+++ b/tests/specs/lint/workspace_no_slow_types/a.out
@@ -0,0 +1,14 @@
+error[no-slow-types]: missing explicit return type in the public API
+ --> [WILDLINE]a.ts:1:17
+ |
+1 | export function noReturnType() {
+ | ^^^^^^^^^^^^ this function is missing an explicit return type
+ |
+ = hint: add an explicit return type to the function
+
+ info: all functions in the public API must have an explicit return type
+ docs: https://jsr.io/go/slow-type-missing-explicit-return-type
+
+
+Found 1 problem
+Checked 1 file
diff --git a/tests/specs/lint/workspace_no_slow_types/a/a.ts b/tests/specs/lint/workspace_no_slow_types/a/a.ts
new file mode 100644
index 000000000..6db944d6c
--- /dev/null
+++ b/tests/specs/lint/workspace_no_slow_types/a/a.ts
@@ -0,0 +1,3 @@
+export function noReturnType() {
+ return Math.random();
+}
diff --git a/tests/specs/lint/workspace_no_slow_types/a/deno.json b/tests/specs/lint/workspace_no_slow_types/a/deno.json
new file mode 100644
index 000000000..9547d1bd9
--- /dev/null
+++ b/tests/specs/lint/workspace_no_slow_types/a/deno.json
@@ -0,0 +1,5 @@
+{
+ "name": "@scope/a",
+ "version": "1.0.0",
+ "exports": "./a.ts"
+}
diff --git a/tests/specs/lint/workspace_no_slow_types/b.out b/tests/specs/lint/workspace_no_slow_types/b.out
new file mode 100644
index 000000000..e3e2d575d
--- /dev/null
+++ b/tests/specs/lint/workspace_no_slow_types/b.out
@@ -0,0 +1,14 @@
+error[no-slow-types]: missing explicit return type in the public API
+ --> [WILDLINE]b.ts:7:17
+ |
+7 | export function doesNotHaveReturnType() {
+ | ^^^^^^^^^^^^^^^^^^^^^ this function is missing an explicit return type
+ |
+ = hint: add an explicit return type to the function
+
+ info: all functions in the public API must have an explicit return type
+ docs: https://jsr.io/go/slow-type-missing-explicit-return-type
+
+
+Found 1 problem
+Checked 1 file
diff --git a/tests/specs/lint/workspace_no_slow_types/b/b.ts b/tests/specs/lint/workspace_no_slow_types/b/b.ts
new file mode 100644
index 000000000..05cb08628
--- /dev/null
+++ b/tests/specs/lint/workspace_no_slow_types/b/b.ts
@@ -0,0 +1,9 @@
+import { noReturnType } from "@scope/a";
+
+export function hasReturnType(): number {
+ return noReturnType();
+}
+
+export function doesNotHaveReturnType() {
+ return noReturnType();
+}
diff --git a/tests/specs/lint/workspace_no_slow_types/b/deno.json b/tests/specs/lint/workspace_no_slow_types/b/deno.json
new file mode 100644
index 000000000..a27c1e5cd
--- /dev/null
+++ b/tests/specs/lint/workspace_no_slow_types/b/deno.json
@@ -0,0 +1,5 @@
+{
+ "name": "@scope/b",
+ "version": "1.0.0",
+ "exports": "./b.ts"
+}
diff --git a/tests/specs/lint/workspace_no_slow_types/c/c.ts b/tests/specs/lint/workspace_no_slow_types/c/c.ts
new file mode 100644
index 000000000..3f5f46171
--- /dev/null
+++ b/tests/specs/lint/workspace_no_slow_types/c/c.ts
@@ -0,0 +1,6 @@
+import { noReturnType } from "@scope/a";
+import { hasReturnType } from "@scope/b";
+
+export function myExport(): number {
+ return noReturnType() + hasReturnType();
+}
diff --git a/tests/specs/lint/workspace_no_slow_types/c/deno.json b/tests/specs/lint/workspace_no_slow_types/c/deno.json
new file mode 100644
index 000000000..618250b98
--- /dev/null
+++ b/tests/specs/lint/workspace_no_slow_types/c/deno.json
@@ -0,0 +1,5 @@
+{
+ "name": "@scope/c",
+ "version": "1.0.0",
+ "exports": "./c.ts"
+}
diff --git a/tests/specs/lint/workspace_no_slow_types/deno.json b/tests/specs/lint/workspace_no_slow_types/deno.json
new file mode 100644
index 000000000..499731c1e
--- /dev/null
+++ b/tests/specs/lint/workspace_no_slow_types/deno.json
@@ -0,0 +1,7 @@
+{
+ "workspace": [
+ "./a",
+ "./b",
+ "./c"
+ ]
+}
diff --git a/tests/specs/lint/workspace_no_slow_types/root.out b/tests/specs/lint/workspace_no_slow_types/root.out
new file mode 100644
index 000000000..50fda50c3
--- /dev/null
+++ b/tests/specs/lint/workspace_no_slow_types/root.out
@@ -0,0 +1,26 @@
+error[no-slow-types]: missing explicit return type in the public API
+ --> [WILDLINE]a.ts:1:17
+ |
+1 | export function noReturnType() {
+ | ^^^^^^^^^^^^ this function is missing an explicit return type
+ |
+ = hint: add an explicit return type to the function
+
+ info: all functions in the public API must have an explicit return type
+ docs: https://jsr.io/go/slow-type-missing-explicit-return-type
+
+
+error[no-slow-types]: missing explicit return type in the public API
+ --> [WILDLINE]b.ts:7:17
+ |
+7 | export function doesNotHaveReturnType() {
+ | ^^^^^^^^^^^^^^^^^^^^^ this function is missing an explicit return type
+ |
+ = hint: add an explicit return type to the function
+
+ info: all functions in the public API must have an explicit return type
+ docs: https://jsr.io/go/slow-type-missing-explicit-return-type
+
+
+Found 2 problems
+Checked 3 files
diff --git a/tests/specs/npm/check_prefers_non_types_node_pkg/__test__.jsonc b/tests/specs/npm/check_prefers_non_types_node_pkg/__test__.jsonc
index ed3827ef6..8c4d0fb20 100644
--- a/tests/specs/npm/check_prefers_non_types_node_pkg/__test__.jsonc
+++ b/tests/specs/npm/check_prefers_non_types_node_pkg/__test__.jsonc
@@ -1,7 +1,28 @@
{
- "envs": {
- "DENO_FUTURE": "1"
- },
- "args": "check --quiet main.ts",
- "output": ""
+ "tempDir": true,
+ "tests": {
+ "byonm": {
+ "envs": {
+ "DENO_FUTURE": "1"
+ },
+ "steps": [{
+ "args": "install",
+ "output": "[WILDCARD]"
+ }, {
+ "args": "check --quiet main.ts",
+ "exitCode": 1,
+ "output": "expected.out"
+ }]
+ },
+ "auto_install": {
+ "args": "check --node-modules-dir=true --quiet main.ts",
+ "exitCode": 1,
+ "output": "expected.out"
+ },
+ "global_folder": {
+ "args": "check --node-modules-dir=false --quiet main.ts",
+ "exitCode": 1,
+ "output": "expected.out"
+ }
+ }
}
diff --git a/tests/specs/npm/check_prefers_non_types_node_pkg/expected.out b/tests/specs/npm/check_prefers_non_types_node_pkg/expected.out
new file mode 100644
index 000000000..37d41aae2
--- /dev/null
+++ b/tests/specs/npm/check_prefers_non_types_node_pkg/expected.out
@@ -0,0 +1,4 @@
+error: TS2345 [ERROR]: Argument of type 'number' is not assignable to parameter of type 'string'.
+console.log(compressToEncodedURIComponent(123));
+ ~~~
+ at file:///[WILDLINE]
diff --git a/tests/specs/npm/check_prefers_non_types_node_pkg/main.ts b/tests/specs/npm/check_prefers_non_types_node_pkg/main.ts
index 8774bdbfc..f28d132d1 100644
--- a/tests/specs/npm/check_prefers_non_types_node_pkg/main.ts
+++ b/tests/specs/npm/check_prefers_non_types_node_pkg/main.ts
@@ -1,3 +1,5 @@
+// this lz-string@1.5 pkg has types only in the regular package and not the @types/lz-string pkg
import { compressToEncodedURIComponent } from "lz-string";
-console.log(compressToEncodedURIComponent("Hello, World!"));
+// cause a deliberate type checking error
+console.log(compressToEncodedURIComponent(123));
diff --git a/tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/@types/lz-string/package.json b/tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/@types/lz-string/package.json
deleted file mode 100644
index afe623e00..000000000
--- a/tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/@types/lz-string/package.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name": "@types/lz-string",
- "version": "1.5.0",
- "description": "Stub TypeScript definitions entry for lz-string, which provides its own types definitions",
- "main": "",
- "scripts": {},
- "license": "MIT",
- "dependencies": {
- "lz-string": "*"
- },
- "deprecated": "This is a stub types definition. lz-string provides its own type definitions, so you do not need this installed."
-}
diff --git a/tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/lz-string/index.d.ts b/tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/lz-string/index.d.ts
deleted file mode 100644
index b6abfd8ba..000000000
--- a/tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/lz-string/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export function compressToEncodedURIComponent(input: string): string;
diff --git a/tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/lz-string/index.js b/tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/lz-string/index.js
deleted file mode 100644
index 603b710ba..000000000
--- a/tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/lz-string/index.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports.compressToEncodedURIComponent = (a) => a;
diff --git a/tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/lz-string/package.json b/tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/lz-string/package.json
deleted file mode 100644
index f8bfd5d98..000000000
--- a/tests/specs/npm/check_prefers_non_types_node_pkg/node_modules/lz-string/package.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "name": "lz-string",
- "version": "1.5.0"
-} \ No newline at end of file
diff --git a/tests/specs/npm/check_prefers_non_types_node_pkg/package.json b/tests/specs/npm/check_prefers_non_types_node_pkg/package.json
index ea3b2d26f..a812a973e 100644
--- a/tests/specs/npm/check_prefers_non_types_node_pkg/package.json
+++ b/tests/specs/npm/check_prefers_non_types_node_pkg/package.json
@@ -1,6 +1,6 @@
{
"dependencies": {
- "lz-string": "*",
- "@types/lz-string": "*"
+ "lz-string": "1.5",
+ "@types/lz-string": "1.5"
}
}
diff --git a/tests/specs/npm/check_types_in_types_pkg/__test__.jsonc b/tests/specs/npm/check_types_in_types_pkg/__test__.jsonc
new file mode 100644
index 000000000..7b7a429f4
--- /dev/null
+++ b/tests/specs/npm/check_types_in_types_pkg/__test__.jsonc
@@ -0,0 +1,28 @@
+{
+ "tempDir": true,
+ "tests": {
+ "byonm": {
+ "envs": {
+ "DENO_FUTURE": "1"
+ },
+ "steps": [{
+ "args": "install",
+ "output": "[WILDCARD]"
+ }, {
+ "args": "check --quiet main.ts",
+ "exitCode": 1,
+ "output": "expected.out"
+ }]
+ },
+ "auto_install": {
+ "args": "check --node-modules-dir=true --quiet main_auto_install.ts",
+ "exitCode": 1,
+ "output": "expected.out"
+ },
+ "global_folder": {
+ "args": "check --node-modules-dir=false --quiet main_auto_install.ts",
+ "exitCode": 1,
+ "output": "expected.out"
+ }
+ }
+}
diff --git a/tests/specs/npm/check_types_in_types_pkg/expected.out b/tests/specs/npm/check_types_in_types_pkg/expected.out
new file mode 100644
index 000000000..37d41aae2
--- /dev/null
+++ b/tests/specs/npm/check_types_in_types_pkg/expected.out
@@ -0,0 +1,4 @@
+error: TS2345 [ERROR]: Argument of type 'number' is not assignable to parameter of type 'string'.
+console.log(compressToEncodedURIComponent(123));
+ ~~~
+ at file:///[WILDLINE]
diff --git a/tests/specs/npm/check_types_in_types_pkg/main.ts b/tests/specs/npm/check_types_in_types_pkg/main.ts
new file mode 100644
index 000000000..adc164ea5
--- /dev/null
+++ b/tests/specs/npm/check_types_in_types_pkg/main.ts
@@ -0,0 +1,5 @@
+// this lz-string@1.3 pkg doesn't have types, but the @types/lz-string@1.3 does
+import { compressToEncodedURIComponent } from "lz-string";
+
+// cause a deliberate type checking error
+console.log(compressToEncodedURIComponent(123));
diff --git a/tests/specs/npm/check_types_in_types_pkg/main_auto_install.ts b/tests/specs/npm/check_types_in_types_pkg/main_auto_install.ts
new file mode 100644
index 000000000..af47e13ac
--- /dev/null
+++ b/tests/specs/npm/check_types_in_types_pkg/main_auto_install.ts
@@ -0,0 +1,6 @@
+// this lz-string@1.3 pkg doesn't have types, but the @types/lz-string@1.3 does
+// @deno-types="@types/lz-string"
+import { compressToEncodedURIComponent } from "lz-string";
+
+// cause a deliberate type checking error
+console.log(compressToEncodedURIComponent(123));
diff --git a/tests/specs/npm/check_types_in_types_pkg/package.json b/tests/specs/npm/check_types_in_types_pkg/package.json
new file mode 100644
index 000000000..e8079d112
--- /dev/null
+++ b/tests/specs/npm/check_types_in_types_pkg/package.json
@@ -0,0 +1,6 @@
+{
+ "dependencies": {
+ "lz-string": "1.3",
+ "@types/lz-string": "1.3"
+ }
+}
diff --git a/tests/specs/npm/workspace_basic/__test__.jsonc b/tests/specs/npm/workspace_basic/__test__.jsonc
new file mode 100644
index 000000000..79e059ca1
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/__test__.jsonc
@@ -0,0 +1,35 @@
+{
+ "tempDir": true,
+ "tests": {
+ "global_cache": {
+ "args": "run --node-modules-dir=false b/main.ts",
+ "output": "b/main_global_cache.out"
+ },
+ "node_modules_dir": {
+ "args": "run --node-modules-dir=true b/main.ts",
+ "output": "b/main_node_modules_dir.out"
+ },
+ "byonm": {
+ "envs": {
+ "DENO_FUTURE": "1"
+ },
+ "steps": [{
+ "args": "install",
+ "output": "[WILDCARD]"
+ }, {
+ "args": "run b/main.ts",
+ "output": "b/main_byonm.out"
+ }]
+ },
+ "exports_sub_path_not_exists": {
+ "args": "run b/exports-sub-path-not-exists.ts",
+ "output": "b/exports-sub-path-not-exists.out",
+ "exitCode": 1
+ },
+ "no_exports_sub_path_not_exists": {
+ "args": "run b/no-exports-sub-path-not-exists.ts",
+ "output": "b/no-exports-sub-path-not-exists.out",
+ "exitCode": 1
+ }
+ }
+}
diff --git a/tests/specs/npm/workspace_basic/a/mod.ts b/tests/specs/npm/workspace_basic/a/mod.ts
new file mode 100644
index 000000000..9f8d1c594
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/a/mod.ts
@@ -0,0 +1,6 @@
+import { getValue, setValue } from "@denotest/esm-basic";
+
+export function sayHello() {
+ setValue(5);
+ console.log("Hello", getValue());
+}
diff --git a/tests/specs/npm/workspace_basic/a/package.json b/tests/specs/npm/workspace_basic/a/package.json
new file mode 100644
index 000000000..1467823cf
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/a/package.json
@@ -0,0 +1,10 @@
+{
+ "name": "@denotest/a",
+ "version": "1.0.0",
+ "dependencies": {
+ "@denotest/esm-basic": "*"
+ },
+ "exports": {
+ ".": "./mod.ts"
+ }
+}
diff --git a/tests/specs/npm/workspace_basic/b/exports-sub-path-not-exists.out b/tests/specs/npm/workspace_basic/b/exports-sub-path-not-exists.out
new file mode 100644
index 000000000..5e61cdfc3
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/b/exports-sub-path-not-exists.out
@@ -0,0 +1,2 @@
+error: [ERR_PACKAGE_PATH_NOT_EXPORTED] Package subpath './non-existent' is not defined by "exports" in '[WILDLINE]package.json' imported from '[WILDLINE]exports-sub-path-not-exists.ts'
+ at file:///[WILDLINE]exports-sub-path-not-exists.ts:1:20
diff --git a/tests/specs/npm/workspace_basic/b/exports-sub-path-not-exists.ts b/tests/specs/npm/workspace_basic/b/exports-sub-path-not-exists.ts
new file mode 100644
index 000000000..716f0f97d
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/b/exports-sub-path-not-exists.ts
@@ -0,0 +1,2 @@
+import * as a from "@denotest/a/non-existent";
+console.log(a);
diff --git a/tests/specs/npm/workspace_basic/b/main.ts b/tests/specs/npm/workspace_basic/b/main.ts
new file mode 100644
index 000000000..03956388c
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/b/main.ts
@@ -0,0 +1,9 @@
+import * as a1 from "@denotest/a";
+import * as a2 from "npm:@denotest/a@1";
+import * as a3 from "npm:@denotest/a@workspace";
+import * as c from "@denotest/c";
+
+a1.sayHello();
+a2.sayHello();
+a3.sayHello();
+c.sayHello();
diff --git a/tests/specs/npm/workspace_basic/b/main_byonm.out b/tests/specs/npm/workspace_basic/b/main_byonm.out
new file mode 100644
index 000000000..3a311dcd7
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/b/main_byonm.out
@@ -0,0 +1,4 @@
+Hello 5
+Hello 5
+Hello 5
+C: Hi!
diff --git a/tests/specs/npm/workspace_basic/b/main_global_cache.out b/tests/specs/npm/workspace_basic/b/main_global_cache.out
new file mode 100644
index 000000000..1ca11026a
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/b/main_global_cache.out
@@ -0,0 +1,6 @@
+Download http://localhost:4260/@denotest/esm-basic
+Download http://localhost:4260/@denotest/esm-basic/1.0.0.tgz
+Hello 5
+Hello 5
+Hello 5
+C: Hi!
diff --git a/tests/specs/npm/workspace_basic/b/main_node_modules_dir.out b/tests/specs/npm/workspace_basic/b/main_node_modules_dir.out
new file mode 100644
index 000000000..82a49b9fe
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/b/main_node_modules_dir.out
@@ -0,0 +1,7 @@
+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
+Hello 5
+Hello 5
+Hello 5
+C: Hi!
diff --git a/tests/specs/npm/workspace_basic/b/no-exports-sub-path-not-exists.out b/tests/specs/npm/workspace_basic/b/no-exports-sub-path-not-exists.out
new file mode 100644
index 000000000..f98aa34cb
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/b/no-exports-sub-path-not-exists.out
@@ -0,0 +1,3 @@
+[# not the best error, but it did resolve because there was no exports specified]
+error: Module not found "file:///[WILDLINE]/c/non-existent".
+ at file:///[WILDLINE]/b/no-exports-sub-path-not-exists.ts:1:20
diff --git a/tests/specs/npm/workspace_basic/b/no-exports-sub-path-not-exists.ts b/tests/specs/npm/workspace_basic/b/no-exports-sub-path-not-exists.ts
new file mode 100644
index 000000000..960d32870
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/b/no-exports-sub-path-not-exists.ts
@@ -0,0 +1,2 @@
+import * as c from "@denotest/c/non-existent";
+console.log(c);
diff --git a/tests/specs/npm/workspace_basic/b/package.json b/tests/specs/npm/workspace_basic/b/package.json
new file mode 100644
index 000000000..4b876d5b9
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/b/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "@denotest/b",
+ "version": "1.0.0",
+ "dependencies": {
+ "@denotest/a": "1",
+ "@denotest/c": "workspace:*"
+ }
+}
diff --git a/tests/specs/npm/workspace_basic/c/index.js b/tests/specs/npm/workspace_basic/c/index.js
new file mode 100644
index 000000000..f412f7d4b
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/c/index.js
@@ -0,0 +1,3 @@
+export function sayHello() {
+ console.log("C: Hi!");
+}
diff --git a/tests/specs/npm/workspace_basic/c/package.json b/tests/specs/npm/workspace_basic/c/package.json
new file mode 100644
index 000000000..7d5ca9abf
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/c/package.json
@@ -0,0 +1,4 @@
+{
+ "name": "@denotest/c",
+ "version": "1.0.0"
+}
diff --git a/tests/specs/npm/workspace_basic/package.json b/tests/specs/npm/workspace_basic/package.json
new file mode 100644
index 000000000..e3dd981e5
--- /dev/null
+++ b/tests/specs/npm/workspace_basic/package.json
@@ -0,0 +1,7 @@
+{
+ "workspaces": [
+ "./a",
+ "./b",
+ "./c"
+ ]
+}
diff --git a/tests/specs/publish/byonm_dep/publish.out b/tests/specs/publish/byonm_dep/publish.out
index a7433f86f..64cf90921 100644
--- a/tests/specs/publish/byonm_dep/publish.out
+++ b/tests/specs/publish/byonm_dep/publish.out
@@ -2,6 +2,6 @@ Check file:///[WILDLINE]/mod.ts
Checking for slow types in the public API...
Check file:///[WILDLINE]/mod.ts
Simulating publish of @scope/package@0.0.0 with files:
- file:///[WILDLINE]/deno.jsonc (300B)
- file:///[WILDLINE]/mod.ts (129B)
+ file:///[WILDLINE]/deno.jsonc ([WILDLINE])
+ file:///[WILDLINE]/mod.ts ([WILDLINE])
Warning Aborting due to --dry-run
diff --git a/tests/specs/publish/workspace/__test__.jsonc b/tests/specs/publish/workspace/__test__.jsonc
index 7b1c04d56..706b08ccd 100644
--- a/tests/specs/publish/workspace/__test__.jsonc
+++ b/tests/specs/publish/workspace/__test__.jsonc
@@ -1,10 +1,13 @@
{
- "steps": [{
- "args": "publish --token 'sadfasdf'",
- "output": "workspace.out"
- }, {
- "cwd": "./bar",
- "args": "publish --token 'sadfasdf'",
- "output": "workspace_individual.out"
- }]
+ "tests": {
+ "workspace": {
+ "args": "publish --token 'sadfasdf'",
+ "output": "workspace.out"
+ },
+ "individual": {
+ "cwd": "./bar",
+ "args": "publish --token 'sadfasdf'",
+ "output": "workspace_individual.out"
+ }
+ }
}
diff --git a/tests/specs/publish/workspace/deno.json b/tests/specs/publish/workspace/deno.json
index 57602aab5..a23790570 100644
--- a/tests/specs/publish/workspace/deno.json
+++ b/tests/specs/publish/workspace/deno.json
@@ -1,5 +1,5 @@
{
- "workspaces": [
+ "workspace": [
"foo",
"bar"
]
diff --git a/tests/specs/publish/workspace/workspace.out b/tests/specs/publish/workspace/workspace.out
index 8c57bc2dd..3114e36db 100644
--- a/tests/specs/publish/workspace/workspace.out
+++ b/tests/specs/publish/workspace/workspace.out
@@ -1,9 +1,9 @@
Publishing a workspace...
-Check file:///[WILDCARD]/foo/mod.ts
-Check file:///[WILDCARD]/bar/mod.ts
+Check file:///[WILDLINE]/bar/mod.ts
+Check file:///[WILDLINE]/foo/mod.ts
Checking for slow types in the public API...
-Check file:///[WILDCARD]/foo/mod.ts
-Check file:///[WILDCARD]/bar/mod.ts
+Check file:///[WILDLINE]/bar/mod.ts
+Check file:///[WILDLINE]/foo/mod.ts
Publishing @foo/bar@1.0.0 ...
Successfully published @foo/bar@1.0.0
Visit http://127.0.0.1:4250/@foo/bar@1.0.0 for details
diff --git a/tests/specs/publish/workspace/workspace_individual.out b/tests/specs/publish/workspace/workspace_individual.out
index edb6b53aa..2cb071709 100644
--- a/tests/specs/publish/workspace/workspace_individual.out
+++ b/tests/specs/publish/workspace/workspace_individual.out
@@ -1,6 +1,6 @@
-Check file:///[WILDCARD]/bar/mod.ts
+Check file:///[WILDLINE]/bar/mod.ts
Checking for slow types in the public API...
-Check file:///[WILDCARD]/bar/mod.ts
+Check file:///[WILDLINE]/bar/mod.ts
Publishing @foo/bar@1.0.0 ...
Successfully published @foo/bar@1.0.0
Visit http://127.0.0.1:4250/@foo/bar@1.0.0 for details
diff --git a/tests/specs/run/no_deno_json/__test__.jsonc b/tests/specs/run/no_deno_json/__test__.jsonc
index 67867f023..5da0209b9 100644
--- a/tests/specs/run/no_deno_json/__test__.jsonc
+++ b/tests/specs/run/no_deno_json/__test__.jsonc
@@ -1,36 +1,43 @@
{
"tempDir": true,
- "steps": [{
- // --no-config
- "args": "run -L debug -A --no-config noconfig.ts",
- "output": "noconfig.out",
- "cwd": "code"
- }, {
- // --no-npm
- "args": "run -L debug -A --no-npm noconfig.ts",
- "output": "noconfig.out",
- "cwd": "code"
- }, {
- // not auto-discovered with env var
- "args": "run -L debug -A noconfig.ts",
- "output": "noconfig.out",
- "cwd": "code",
- "envs": {
- "DENO_NO_PACKAGE_JSON": "1"
+ "tests": {
+ "no_config": {
+ // --no-config
+ "args": "run -L debug -A --no-config noconfig.ts",
+ "output": "noconfig.out",
+ "cwd": "code"
+ },
+ "no_npm": {
+ // --no-npm
+ "args": "run -L debug -A --no-npm noconfig.ts",
+ "output": "noconfig.out",
+ "cwd": "code"
+ },
+ "no_pkg_json_env_var": {
+ // not auto-discovered with env var
+ "args": "run -L debug -A noconfig.ts",
+ "output": "no_package_json.out",
+ "cwd": "code",
+ "envs": {
+ "DENO_NO_PACKAGE_JSON": "1"
+ }
+ },
+ "no_pkg_json_imports": {
+ // this should not use --quiet because we should ensure no package.json install occurs
+ "args": "run -A no_package_json_imports.ts",
+ "output": "no_package_json_imports.out",
+ "cwd": "code"
+ },
+ "auto_discovered": {
+ // auto-discovered node_modules relative package.json
+ "args": "run -A main.js",
+ "output": "code/sub_dir/main.out",
+ "cwd": "code/sub_dir"
+ },
+ "auto_discovered_arg": {
+ // auto-discovered for local script arg
+ "args": "run -L debug -A code/main.ts", // notice this is not in the sub dir
+ "output": "main.out"
}
- }, {
- // this should not use --quiet because we should ensure no package.json install occurs
- "args": "run -A no_package_json_imports.ts",
- "output": "no_package_json_imports.out",
- "cwd": "code"
- }, {
- // auto-discovered node_modules relative package.json
- "args": "run -A main.js",
- "output": "code/sub_dir/main.out",
- "cwd": "code/sub_dir"
- }, {
- // auto-discovered for local script arg
- "args": "run -L debug -A code/main.ts", // notice this is not in the sub dir
- "output": "main.out"
- }]
+ }
}
diff --git a/tests/specs/run/no_deno_json/no_package_json.out b/tests/specs/run/no_deno_json/no_package_json.out
new file mode 100644
index 000000000..b9f9a6dea
--- /dev/null
+++ b/tests/specs/run/no_deno_json/no_package_json.out
@@ -0,0 +1,4 @@
+[WILDCARD]package.json auto-discovery is disabled
+[WILDCARD]
+success
+[WILDCARD]
diff --git a/tests/specs/run/no_deno_json/noconfig.out b/tests/specs/run/no_deno_json/noconfig.out
index b9f9a6dea..000ce402b 100644
--- a/tests/specs/run/no_deno_json/noconfig.out
+++ b/tests/specs/run/no_deno_json/noconfig.out
@@ -1,4 +1,3 @@
-[WILDCARD]package.json auto-discovery is disabled
[WILDCARD]
success
[WILDCARD]
diff --git a/tests/specs/run/workspaces/basic/deno.json b/tests/specs/run/workspaces/basic/deno.json
index b971c4f3d..a39778a6d 100644
--- a/tests/specs/run/workspaces/basic/deno.json
+++ b/tests/specs/run/workspaces/basic/deno.json
@@ -1,5 +1,5 @@
{
- "workspaces": [
+ "workspace": [
"foo",
"bar"
],
diff --git a/tests/specs/run/workspaces/basic/main.out b/tests/specs/run/workspaces/basic/main.out
index 57d8c9f1e..9806f7d63 100644
--- a/tests/specs/run/workspaces/basic/main.out
+++ b/tests/specs/run/workspaces/basic/main.out
@@ -2,19 +2,19 @@
"imports": {
"chalk": "npm:chalk",
"chalk/": "npm:/chalk/",
- "qwerqwer": "jsr:qwerqwer@^0.0.0",
- "qwerqwer/": "jsr:/qwerqwer@^0.0.0/",
"asdfasdfasdf": "jsr:asdfasdfasdf@^0.0.0",
- "asdfasdfasdf/": "jsr:/asdfasdfasdf@^0.0.0/"
+ "asdfasdfasdf/": "jsr:/asdfasdfasdf@^0.0.0/",
+ "qwerqwer": "jsr:qwerqwer@^0.0.0",
+ "qwerqwer/": "jsr:/qwerqwer@^0.0.0/"
},
"scopes": {
- "./foo/": {
- "~/": "./foo/",
- "foo/": "./foo/bar/"
- },
"./bar/": {
"@/": "./bar/",
"secret_mod/": "./bar/some_mod/"
+ },
+ "./foo/": {
+ "~/": "./foo/",
+ "foo/": "./foo/bar/"
}
}
}
diff --git a/tests/specs/run/workspaces/member_outside_root_dir/__test__.jsonc b/tests/specs/run/workspaces/member_outside_root_dir/__test__.jsonc
index a7669c1ec..3b7f35c62 100644
--- a/tests/specs/run/workspaces/member_outside_root_dir/__test__.jsonc
+++ b/tests/specs/run/workspaces/member_outside_root_dir/__test__.jsonc
@@ -1,5 +1,5 @@
{
- "args": "run -A main.ts",
+ "args": "run -A sub_dir/child/main.ts",
"output": "main.out",
"tempDir": true,
"exitCode": 1
diff --git a/tests/specs/run/workspaces/member_outside_root_dir/main.out b/tests/specs/run/workspaces/member_outside_root_dir/main.out
index 205d95aea..72f0b0b45 100644
--- a/tests/specs/run/workspaces/member_outside_root_dir/main.out
+++ b/tests/specs/run/workspaces/member_outside_root_dir/main.out
@@ -1 +1,3 @@
-error: Workspace member '../other_folder' is outside root configuration directory[WILDCARD] \ No newline at end of file
+error: Workspace member must be nested in a directory under the workspace.
+ Member: file:///[WILDLINE]/sub_dir/other_folder/
+ Workspace: file:///[WILDLINE]/sub_dir/child/
diff --git a/tests/specs/run/workspaces/member_outside_root_dir/deno.json b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/deno.json
index 25feefad8..189d212b5 100644
--- a/tests/specs/run/workspaces/member_outside_root_dir/deno.json
+++ b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/deno.json
@@ -1,5 +1,5 @@
{
- "workspaces": [
+ "workspace": [
"foo",
"../other_folder"
],
diff --git a/tests/specs/run/workspaces/member_outside_root_dir/foo/bar/hello.ts b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/bar/hello.ts
index c8a7e57c4..c8a7e57c4 100644
--- a/tests/specs/run/workspaces/member_outside_root_dir/foo/bar/hello.ts
+++ b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/bar/hello.ts
diff --git a/tests/specs/run/workspaces/member_outside_root_dir/foo/deno.json b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/deno.json
index 46d84f06f..46d84f06f 100644
--- a/tests/specs/run/workspaces/member_outside_root_dir/foo/deno.json
+++ b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/deno.json
diff --git a/tests/specs/run/workspaces/member_outside_root_dir/foo/fizz/buzz.ts b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/fizz/buzz.ts
index 4e03777d1..4e03777d1 100644
--- a/tests/specs/run/workspaces/member_outside_root_dir/foo/fizz/buzz.ts
+++ b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/fizz/buzz.ts
diff --git a/tests/specs/run/workspaces/member_outside_root_dir/foo/mod.ts b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/mod.ts
index d7b16dcc0..d7b16dcc0 100644
--- a/tests/specs/run/workspaces/member_outside_root_dir/foo/mod.ts
+++ b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/foo/mod.ts
diff --git a/tests/specs/run/workspaces/member_outside_root_dir/main.ts b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/main.ts
index 182fd8517..182fd8517 100644
--- a/tests/specs/run/workspaces/member_outside_root_dir/main.ts
+++ b/tests/specs/run/workspaces/member_outside_root_dir/sub_dir/child/main.ts
diff --git a/tests/specs/run/workspaces/members_are_imports/deno.json b/tests/specs/run/workspaces/members_are_imports/deno.json
index 56105365a..51d1d21de 100644
--- a/tests/specs/run/workspaces/members_are_imports/deno.json
+++ b/tests/specs/run/workspaces/members_are_imports/deno.json
@@ -1,5 +1,5 @@
{
- "workspaces": [
+ "workspace": [
"foo",
"bar"
],
diff --git a/tests/specs/run/workspaces/nested_member/__test__.jsonc b/tests/specs/run/workspaces/nested_member/__test__.jsonc
index a7669c1ec..fe02eacbc 100644
--- a/tests/specs/run/workspaces/nested_member/__test__.jsonc
+++ b/tests/specs/run/workspaces/nested_member/__test__.jsonc
@@ -2,5 +2,5 @@
"args": "run -A main.ts",
"output": "main.out",
"tempDir": true,
- "exitCode": 1
+ "exitCode": 0
}
diff --git a/tests/specs/run/workspaces/nested_member/bar/deno.json b/tests/specs/run/workspaces/nested_member/bar/deno.json
index ef3bfc37a..3bc0e52ec 100644
--- a/tests/specs/run/workspaces/nested_member/bar/deno.json
+++ b/tests/specs/run/workspaces/nested_member/bar/deno.json
@@ -4,5 +4,6 @@
"imports": {
"@/": "./",
"secret_mod/": "./some_mod/"
- }
+ },
+ "exports": "./mod.ts"
}
diff --git a/tests/specs/run/workspaces/nested_member/deno.json b/tests/specs/run/workspaces/nested_member/deno.json
index 6d9c09d4d..8108d54fc 100644
--- a/tests/specs/run/workspaces/nested_member/deno.json
+++ b/tests/specs/run/workspaces/nested_member/deno.json
@@ -1,5 +1,5 @@
{
- "workspaces": [
+ "workspace": [
"foo",
"foo/bar"
]
diff --git a/tests/specs/run/workspaces/nested_member/foo/bar/deno.json b/tests/specs/run/workspaces/nested_member/foo/bar/deno.json
index d40328b36..d4948ddbb 100644
--- a/tests/specs/run/workspaces/nested_member/foo/bar/deno.json
+++ b/tests/specs/run/workspaces/nested_member/foo/bar/deno.json
@@ -3,5 +3,6 @@
"version": "0.0.0",
"imports": {
"chalk": "npm:chalk"
- }
+ },
+ "exports": "./hello.ts"
}
diff --git a/tests/specs/run/workspaces/nested_member/foo/deno.json b/tests/specs/run/workspaces/nested_member/foo/deno.json
index 68e053b02..6bc959c4d 100644
--- a/tests/specs/run/workspaces/nested_member/foo/deno.json
+++ b/tests/specs/run/workspaces/nested_member/foo/deno.json
@@ -3,5 +3,6 @@
"version": "0.0.0",
"imports": {
"~/": "./"
- }
+ },
+ "exports": "./mod.ts"
}
diff --git a/tests/specs/run/workspaces/nested_member/main.out b/tests/specs/run/workspaces/nested_member/main.out
index 98598a306..ec46186a7 100644
--- a/tests/specs/run/workspaces/nested_member/main.out
+++ b/tests/specs/run/workspaces/nested_member/main.out
@@ -1 +1,4 @@
-error: Workspace member 'foo/bar' is nested within other workspace member 'foo'
+Download http://localhost:4260/chalk
+Download http://localhost:4260/chalk/chalk-5.0.1.tgz
+buzz from foo
+[Function: chalk] createChalk { level: 0 }
diff --git a/tests/specs/task/workspace/__test__.jsonc b/tests/specs/task/workspace/__test__.jsonc
new file mode 100644
index 000000000..b08f35afc
--- /dev/null
+++ b/tests/specs/task/workspace/__test__.jsonc
@@ -0,0 +1,52 @@
+{
+ "tests": {
+ "root": {
+ "args": "task",
+ "output": "root.out",
+ "exitCode": 1
+ },
+ "package_a": {
+ "args": "task",
+ "cwd": "package-a",
+ "output": "package-a.out",
+ "exitCode": 1
+ },
+ "package_b": {
+ "args": "task",
+ "cwd": "package-b",
+ "output": "package-b.out",
+ "exitCode": 1
+ },
+ "scripts": {
+ "args": "task",
+ "cwd": "scripts",
+ "output": "scripts.out",
+ "exitCode": 1
+ },
+ "package_b_tasks": {
+ "steps": [{
+ "args": "task --quiet pkg-json-root",
+ "cwd": "package-b",
+ // uses the workspace as cwd
+ "output": "pkg-json [WILDLINE]workspace\n"
+ }, {
+ "args": "task --quiet pkg-json-root-2",
+ "cwd": "package-b",
+ // uses package-b as cwd
+ "output": "override [WILDLINE]package-b\n"
+ }, {
+ "args": "task --quiet echo-package-b",
+ "cwd": "package-b",
+ "output": "hi [WILDLINE]package-b\n"
+ }, {
+ "args": "task --quiet echo-root",
+ "cwd": "package-b",
+ "output": "override root [WILDLINE]package-b\n"
+ }, {
+ "args": "task --quiet echo-root",
+ "cwd": "package-a",
+ "output": "[WILDLINE]workspace\n"
+ }]
+ }
+ }
+}
diff --git a/tests/specs/task/workspace/deno.json b/tests/specs/task/workspace/deno.json
new file mode 100644
index 000000000..aead0490e
--- /dev/null
+++ b/tests/specs/task/workspace/deno.json
@@ -0,0 +1,9 @@
+{
+ "workspace": [
+ "./package-a",
+ "./package-b"
+ ],
+ "tasks": {
+ "echo-root": "echo $PWD"
+ }
+}
diff --git a/tests/specs/task/workspace/package-a.out b/tests/specs/task/workspace/package-a.out
new file mode 100644
index 000000000..f68d5d24b
--- /dev/null
+++ b/tests/specs/task/workspace/package-a.out
@@ -0,0 +1,9 @@
+Available tasks:
+- echo-package-b
+ echo 'bye'
+- pkg-json-root (workspace package.json)
+ echo pkg-json $PWD
+- pkg-json-root-2 (workspace package.json)
+ echo hi
+- echo-root (workspace)
+ echo $PWD
diff --git a/tests/specs/task/workspace/package-a/deno.json b/tests/specs/task/workspace/package-a/deno.json
new file mode 100644
index 000000000..5167ad857
--- /dev/null
+++ b/tests/specs/task/workspace/package-a/deno.json
@@ -0,0 +1,5 @@
+{
+ "tasks": {
+ "echo-package-b": "echo 'bye'"
+ }
+}
diff --git a/tests/specs/task/workspace/package-b.out b/tests/specs/task/workspace/package-b.out
new file mode 100644
index 000000000..4abd90d23
--- /dev/null
+++ b/tests/specs/task/workspace/package-b.out
@@ -0,0 +1,11 @@
+Available tasks:
+- echo-package-b
+ echo 'hi' $PWD
+- echo-root
+ echo 'override root' $PWD
+- pkg-json-root-2 (package.json)
+ echo override $PWD
+- package-b-json (package.json)
+ echo 'hi from pkg json'
+- pkg-json-root (workspace package.json)
+ echo pkg-json $PWD
diff --git a/tests/specs/task/workspace/package-b/deno.json b/tests/specs/task/workspace/package-b/deno.json
new file mode 100644
index 000000000..0c6420834
--- /dev/null
+++ b/tests/specs/task/workspace/package-b/deno.json
@@ -0,0 +1,6 @@
+{
+ "tasks": {
+ "echo-package-b": "echo 'hi' $PWD",
+ "echo-root": "echo 'override root' $PWD"
+ }
+}
diff --git a/tests/specs/task/workspace/package-b/package.json b/tests/specs/task/workspace/package-b/package.json
new file mode 100644
index 000000000..bc1bdc712
--- /dev/null
+++ b/tests/specs/task/workspace/package-b/package.json
@@ -0,0 +1,6 @@
+{
+ "scripts": {
+ "pkg-json-root-2": "echo override $PWD",
+ "package-b-json": "echo 'hi from pkg json'"
+ }
+}
diff --git a/tests/specs/task/workspace/package.json b/tests/specs/task/workspace/package.json
new file mode 100644
index 000000000..a468ec494
--- /dev/null
+++ b/tests/specs/task/workspace/package.json
@@ -0,0 +1,6 @@
+{
+ "scripts": {
+ "pkg-json-root": "echo pkg-json $PWD",
+ "pkg-json-root-2": "echo hi"
+ }
+}
diff --git a/tests/specs/task/workspace/root.out b/tests/specs/task/workspace/root.out
new file mode 100644
index 000000000..808106c92
--- /dev/null
+++ b/tests/specs/task/workspace/root.out
@@ -0,0 +1,7 @@
+Available tasks:
+- echo-root
+ echo $PWD
+- pkg-json-root (package.json)
+ echo pkg-json $PWD
+- pkg-json-root-2 (package.json)
+ echo hi
diff --git a/tests/specs/task/workspace/scripts.out b/tests/specs/task/workspace/scripts.out
new file mode 100644
index 000000000..808106c92
--- /dev/null
+++ b/tests/specs/task/workspace/scripts.out
@@ -0,0 +1,7 @@
+Available tasks:
+- echo-root
+ echo $PWD
+- pkg-json-root (package.json)
+ echo pkg-json $PWD
+- pkg-json-root-2 (package.json)
+ echo hi
diff --git a/tests/specs/task/workspace/scripts/main.ts b/tests/specs/task/workspace/scripts/main.ts
new file mode 100644
index 000000000..9c11c78bb
--- /dev/null
+++ b/tests/specs/task/workspace/scripts/main.ts
@@ -0,0 +1 @@
+console.log("some file");
diff --git a/tests/specs/test/workspace/__test__.jsonc b/tests/specs/test/workspace/__test__.jsonc
new file mode 100644
index 000000000..87fd3d46d
--- /dev/null
+++ b/tests/specs/test/workspace/__test__.jsonc
@@ -0,0 +1,20 @@
+{
+ "tests": {
+ "root": {
+ "args": "test",
+ "output": "root.out",
+ "exitCode": 1
+ },
+ "package_a": {
+ "args": "test",
+ "cwd": "package-a",
+ "output": "package_a.out"
+ },
+ "package_b": {
+ "args": "test",
+ "cwd": "package-b",
+ "output": "package_b.out",
+ "exitCode": 1
+ }
+ }
+}
diff --git a/tests/specs/test/workspace/deno.json b/tests/specs/test/workspace/deno.json
new file mode 100644
index 000000000..b72d88442
--- /dev/null
+++ b/tests/specs/test/workspace/deno.json
@@ -0,0 +1,6 @@
+{
+ "workspace": [
+ "./package-a",
+ "./package-b"
+ ]
+}
diff --git a/tests/specs/test/workspace/package-a/deno.json b/tests/specs/test/workspace/package-a/deno.json
new file mode 100644
index 000000000..e6e03ae85
--- /dev/null
+++ b/tests/specs/test/workspace/package-a/deno.json
@@ -0,0 +1,5 @@
+{
+ "name": "@scope/a",
+ "version": "1.0.0",
+ "exports": "./mod.ts"
+}
diff --git a/tests/specs/test/workspace/package-a/mod.test.ts b/tests/specs/test/workspace/package-a/mod.test.ts
new file mode 100644
index 000000000..7ef57fbee
--- /dev/null
+++ b/tests/specs/test/workspace/package-a/mod.test.ts
@@ -0,0 +1,7 @@
+import { add } from "./mod.ts";
+
+Deno.test("add", () => {
+ if (add(1, 2) !== 3) {
+ throw new Error("failed");
+ }
+});
diff --git a/tests/specs/test/workspace/package-a/mod.ts b/tests/specs/test/workspace/package-a/mod.ts
new file mode 100644
index 000000000..8d9b8a22a
--- /dev/null
+++ b/tests/specs/test/workspace/package-a/mod.ts
@@ -0,0 +1,3 @@
+export function add(a: number, b: number): number {
+ return a + b;
+}
diff --git a/tests/specs/test/workspace/package-b/deno.json b/tests/specs/test/workspace/package-b/deno.json
new file mode 100644
index 000000000..f131c191b
--- /dev/null
+++ b/tests/specs/test/workspace/package-b/deno.json
@@ -0,0 +1,5 @@
+{
+ "name": "@scope/b",
+ "version": "1.0.0",
+ "exports": "./mod.ts"
+}
diff --git a/tests/specs/test/workspace/package-b/mod.test.ts b/tests/specs/test/workspace/package-b/mod.test.ts
new file mode 100644
index 000000000..f1499a626
--- /dev/null
+++ b/tests/specs/test/workspace/package-b/mod.test.ts
@@ -0,0 +1,11 @@
+import { addOne } from "./mod.ts";
+
+Deno.test("addOne", () => {
+ if (addOne(1) !== 2) {
+ throw new Error("failed");
+ }
+});
+
+Deno.test("fail", () => {
+ throw new Error("failed");
+});
diff --git a/tests/specs/test/workspace/package-b/mod.ts b/tests/specs/test/workspace/package-b/mod.ts
new file mode 100644
index 000000000..53148ac2f
--- /dev/null
+++ b/tests/specs/test/workspace/package-b/mod.ts
@@ -0,0 +1,5 @@
+import { add } from "@scope/a";
+
+export function addOne(a: number): number {
+ return add(a, 1);
+}
diff --git a/tests/specs/test/workspace/package_a.out b/tests/specs/test/workspace/package_a.out
new file mode 100644
index 000000000..6ebcdfb10
--- /dev/null
+++ b/tests/specs/test/workspace/package_a.out
@@ -0,0 +1,6 @@
+Check file:///[WILDLINE]/package-a/mod.test.ts
+running 1 test from ./mod.test.ts
+add ... ok ([WILDLINE])
+
+ok | 1 passed | 0 failed ([WILDLINE])
+
diff --git a/tests/specs/test/workspace/package_b.out b/tests/specs/test/workspace/package_b.out
new file mode 100644
index 000000000..6c13427ee
--- /dev/null
+++ b/tests/specs/test/workspace/package_b.out
@@ -0,0 +1,20 @@
+Check file:///[WILDLINE]/package-b/mod.test.ts
+running 2 tests from ./mod.test.ts
+addOne ... ok ([WILDLINE])
+fail ... FAILED ([WILDLINE])
+
+ ERRORS
+
+fail => ./mod.test.ts:9:6
+error: Error: failed
+ throw new Error("failed");
+ ^
+ at file:///[WILDLINE]/package-b/mod.test.ts:10:9
+
+ FAILURES
+
+fail => ./mod.test.ts:9:6
+
+FAILED | 1 passed | 1 failed ([WILDLINE])
+
+error: Test failed
diff --git a/tests/specs/test/workspace/root.out b/tests/specs/test/workspace/root.out
new file mode 100644
index 000000000..30bda3ac6
--- /dev/null
+++ b/tests/specs/test/workspace/root.out
@@ -0,0 +1,23 @@
+Check file:///[WILDLINE]/package-a/mod.test.ts
+Check file:///[WILDLINE]/package-b/mod.test.ts
+running 1 test from ./package-a/mod.test.ts
+add ... ok ([WILDLINE])
+running 2 tests from ./package-b/mod.test.ts
+addOne ... ok ([WILDLINE])
+fail ... FAILED ([WILDLINE])
+
+ ERRORS
+
+fail => ./package-b/mod.test.ts:9:6
+error: Error: failed
+ throw new Error("failed");
+ ^
+ at file:///[WILDLINE]/package-b/mod.test.ts:10:9
+
+ FAILURES
+
+fail => ./package-b/mod.test.ts:9:6
+
+FAILED | 2 passed | 1 failed ([WILDLINE])
+
+error: Test failed
diff --git a/tests/specs/workspaces/lockfile/__test__.jsonc b/tests/specs/workspaces/lockfile/__test__.jsonc
new file mode 100644
index 000000000..706b44f01
--- /dev/null
+++ b/tests/specs/workspaces/lockfile/__test__.jsonc
@@ -0,0 +1,24 @@
+{
+ "tempDir": true,
+ "steps": [{
+ "cwd": "pkg",
+ "args": "test",
+ "output": "test_pkg.out"
+ }, {
+ // the lockfile should always go to the workspace root
+ "args": [
+ "eval",
+ "try { Deno.readTextFileSync('pkg/deno.lock'); console.log('should not run'); } catch {} console.log(Deno.readTextFileSync('deno.lock'))"
+ ],
+ "output": "expected-lock.out"
+ }, {
+ "args": "test",
+ "output": "test_root.out"
+ }, {
+ "args": [
+ "eval",
+ "try { Deno.readTextFileSync('pkg/deno.lock'); console.log('should not run'); } catch {} console.log(Deno.readTextFileSync('deno.lock'))"
+ ],
+ "output": "expected-lock.out"
+ }]
+}
diff --git a/tests/specs/workspaces/lockfile/deno.json b/tests/specs/workspaces/lockfile/deno.json
new file mode 100644
index 000000000..79c36f622
--- /dev/null
+++ b/tests/specs/workspaces/lockfile/deno.json
@@ -0,0 +1,6 @@
+{
+ "workspace": [
+ "./pkg",
+ "./pkg-no-deps"
+ ]
+}
diff --git a/tests/specs/workspaces/lockfile/expected-lock.out b/tests/specs/workspaces/lockfile/expected-lock.out
new file mode 100644
index 000000000..dcc479a20
--- /dev/null
+++ b/tests/specs/workspaces/lockfile/expected-lock.out
@@ -0,0 +1,24 @@
+{
+ "version": "3",
+ "packages": {
+ "specifiers": {
+ "jsr:@denotest/add@1": "jsr:@denotest/add@1.0.0"
+ },
+ "jsr": {
+ "@denotest/add@1.0.0": {
+ "integrity": "3b2e675c1ad7fba2a45bc251992e01aff08a3c974ac09079b11e6a5b95d4bfcb"
+ }
+ }
+ },
+ "remote": {},
+ "workspace": {
+ "members": {
+ "pkg": {
+ "dependencies": [
+ "jsr:@denotest/add@1"
+ ]
+ }
+ }
+ }
+}
+
diff --git a/tests/specs/workspaces/lockfile/integration.test.ts b/tests/specs/workspaces/lockfile/integration.test.ts
new file mode 100644
index 000000000..91e921b33
--- /dev/null
+++ b/tests/specs/workspaces/lockfile/integration.test.ts
@@ -0,0 +1,7 @@
+import { add } from "@scope/pkg";
+
+Deno.test("should add", () => {
+ if (add(1, 2) !== 3) {
+ throw new Error("failed");
+ }
+});
diff --git a/tests/specs/workspaces/lockfile/pkg-no-deps/deno.jsonc b/tests/specs/workspaces/lockfile/pkg-no-deps/deno.jsonc
new file mode 100644
index 000000000..123cc3b9a
--- /dev/null
+++ b/tests/specs/workspaces/lockfile/pkg-no-deps/deno.jsonc
@@ -0,0 +1,7 @@
+{
+ // this package shouldn't be included in the lockfile members
+ // because it has no dependencies
+ "name": "@scope/pkg2",
+ "version": "1.0.0",
+ "exports": "./mod.ts"
+}
diff --git a/tests/specs/workspaces/lockfile/pkg-no-deps/mod.ts b/tests/specs/workspaces/lockfile/pkg-no-deps/mod.ts
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/specs/workspaces/lockfile/pkg-no-deps/mod.ts
diff --git a/tests/specs/workspaces/lockfile/pkg/deno.jsonc b/tests/specs/workspaces/lockfile/pkg/deno.jsonc
new file mode 100644
index 000000000..7bd6ab450
--- /dev/null
+++ b/tests/specs/workspaces/lockfile/pkg/deno.jsonc
@@ -0,0 +1,8 @@
+{
+ "name": "@scope/pkg",
+ "version": "1.0.0",
+ "exports": "./mod.ts",
+ "imports": {
+ "@denotest/add": "jsr:@denotest/add@1"
+ }
+}
diff --git a/tests/specs/workspaces/lockfile/pkg/mod.test.ts b/tests/specs/workspaces/lockfile/pkg/mod.test.ts
new file mode 100644
index 000000000..9e7a8c445
--- /dev/null
+++ b/tests/specs/workspaces/lockfile/pkg/mod.test.ts
@@ -0,0 +1,7 @@
+import { add } from "./mod.ts";
+
+Deno.test("should add", () => {
+ if (add(1, 2) !== 3) {
+ throw new Error("failed");
+ }
+});
diff --git a/tests/specs/workspaces/lockfile/pkg/mod.ts b/tests/specs/workspaces/lockfile/pkg/mod.ts
new file mode 100644
index 000000000..f69572b49
--- /dev/null
+++ b/tests/specs/workspaces/lockfile/pkg/mod.ts
@@ -0,0 +1,5 @@
+import * as denotestAdd from "@denotest/add";
+
+export function add(a: number, b: number) {
+ return denotestAdd.add(a, b);
+}
diff --git a/tests/specs/workspaces/lockfile/test_pkg.out b/tests/specs/workspaces/lockfile/test_pkg.out
new file mode 100644
index 000000000..da13b7cca
--- /dev/null
+++ b/tests/specs/workspaces/lockfile/test_pkg.out
@@ -0,0 +1,9 @@
+Download http://127.0.0.1:4250/@denotest/add/meta.json
+Download http://127.0.0.1:4250/@denotest/add/1.0.0_meta.json
+Download http://127.0.0.1:4250/@denotest/add/1.0.0/mod.ts
+Check file:///[WILDLINE]/mod.test.ts
+running 1 test from ./mod.test.ts
+should add ... ok ([WILDLINE])
+
+ok | 1 passed | 0 failed ([WILDLINE])
+
diff --git a/tests/specs/workspaces/lockfile/test_root.out b/tests/specs/workspaces/lockfile/test_root.out
new file mode 100644
index 000000000..2c62b615b
--- /dev/null
+++ b/tests/specs/workspaces/lockfile/test_root.out
@@ -0,0 +1,9 @@
+Check file:///[WILDLINE]/integration.test.ts
+Check file:///[WILDLINE]/pkg/mod.test.ts
+running 1 test from ./integration.test.ts
+should add ... ok ([WILDLINE])
+running 1 test from ./pkg/mod.test.ts
+should add ... ok ([WILDLINE])
+
+ok | 2 passed | 0 failed ([WILDLINE])
+
diff --git a/tests/specs/workspaces/non_fatal_diagnostics/__test__.jsonc b/tests/specs/workspaces/non_fatal_diagnostics/__test__.jsonc
new file mode 100644
index 000000000..ab79054b8
--- /dev/null
+++ b/tests/specs/workspaces/non_fatal_diagnostics/__test__.jsonc
@@ -0,0 +1,13 @@
+{
+ "tests": {
+ "root": {
+ "args": "lint",
+ "output": "lint.out"
+ },
+ "subdir": {
+ "cwd": "sub",
+ "args": "lint",
+ "output": "lint.out"
+ }
+ }
+}
diff --git a/tests/specs/workspaces/non_fatal_diagnostics/deno.json b/tests/specs/workspaces/non_fatal_diagnostics/deno.json
new file mode 100644
index 000000000..983a9a3e9
--- /dev/null
+++ b/tests/specs/workspaces/non_fatal_diagnostics/deno.json
@@ -0,0 +1,5 @@
+{
+ "workspace": [
+ "./sub"
+ ]
+}
diff --git a/tests/specs/workspaces/non_fatal_diagnostics/lint.out b/tests/specs/workspaces/non_fatal_diagnostics/lint.out
new file mode 100644
index 000000000..28ac6b0eb
--- /dev/null
+++ b/tests/specs/workspaces/non_fatal_diagnostics/lint.out
@@ -0,0 +1,5 @@
+The 'compilerOptions' field can only be specified in the root workspace deno.json file.
+ at file:///[WILDLINE]/sub/deno.json
+The 'lint.report' field can only be specified in the root workspace deno.json file.
+ at file:///[WILDLINE]/sub/deno.json
+Checked 1 file
diff --git a/tests/specs/workspaces/non_fatal_diagnostics/sub/deno.json b/tests/specs/workspaces/non_fatal_diagnostics/sub/deno.json
new file mode 100644
index 000000000..0a21df89f
--- /dev/null
+++ b/tests/specs/workspaces/non_fatal_diagnostics/sub/deno.json
@@ -0,0 +1,8 @@
+{
+ "lint": {
+ "report": "compact"
+ },
+ "compilerOptions": {
+ "strict": true
+ }
+}
diff --git a/tests/specs/workspaces/non_fatal_diagnostics/sub/main.ts b/tests/specs/workspaces/non_fatal_diagnostics/sub/main.ts
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/specs/workspaces/non_fatal_diagnostics/sub/main.ts
diff --git a/tests/specs/workspaces/vendor/__test__.jsonc b/tests/specs/workspaces/vendor/__test__.jsonc
new file mode 100644
index 000000000..cd44b361b
--- /dev/null
+++ b/tests/specs/workspaces/vendor/__test__.jsonc
@@ -0,0 +1,13 @@
+{
+ "tempDir": true,
+ "steps": [{
+ "args": "run --quiet package-a/mod.ts",
+ "output": "3\n"
+ }, {
+ "args": "run --allow-write=. --allow-read=. modify_vendor.ts",
+ "output": "[WILDLINE]"
+ }, {
+ "args": "run --quiet package-a/mod.ts",
+ "output": "4\n"
+ }]
+}
diff --git a/tests/specs/workspaces/vendor/deno.json b/tests/specs/workspaces/vendor/deno.json
new file mode 100644
index 000000000..62bf7dff9
--- /dev/null
+++ b/tests/specs/workspaces/vendor/deno.json
@@ -0,0 +1,9 @@
+{
+ "vendor": true,
+ "workspace": [
+ "package-a"
+ ],
+ "imports": {
+ "@denotest/add": "jsr:@denotest/add"
+ }
+}
diff --git a/tests/specs/workspaces/vendor/modify_vendor.ts b/tests/specs/workspaces/vendor/modify_vendor.ts
new file mode 100644
index 000000000..3b6dafe14
--- /dev/null
+++ b/tests/specs/workspaces/vendor/modify_vendor.ts
@@ -0,0 +1,7 @@
+Deno.writeTextFileSync(
+ "./vendor/http_127.0.0.1_4250/@denotest/add/1.0.0/mod.ts",
+ `export function add(a: number, b: number): number {
+ return a + b + 1; // evil add
+}
+`,
+);
diff --git a/tests/specs/workspaces/vendor/package-a/deno.json b/tests/specs/workspaces/vendor/package-a/deno.json
new file mode 100644
index 000000000..fe4300ad6
--- /dev/null
+++ b/tests/specs/workspaces/vendor/package-a/deno.json
@@ -0,0 +1,5 @@
+{
+ "name": "@scope/pkg",
+ "version": "1.0.0",
+ "exports": "./mod.ts"
+}
diff --git a/tests/specs/workspaces/vendor/package-a/mod.ts b/tests/specs/workspaces/vendor/package-a/mod.ts
new file mode 100644
index 000000000..1ca631410
--- /dev/null
+++ b/tests/specs/workspaces/vendor/package-a/mod.ts
@@ -0,0 +1,3 @@
+import { add } from "@denotest/add";
+
+console.log(add(1, 2));