diff options
Diffstat (limited to 'tests/specs/npm/workspace_basic')
15 files changed, 108 insertions, 0 deletions
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" + ] +} |