diff options
Diffstat (limited to 'tests/specs/jsr')
31 files changed, 261 insertions, 0 deletions
diff --git a/tests/specs/jsr/deps/__test__.jsonc b/tests/specs/jsr/deps/__test__.jsonc new file mode 100644 index 000000000..2528003b5 --- /dev/null +++ b/tests/specs/jsr/deps/__test__.jsonc @@ -0,0 +1,11 @@ +{ + "base": "jsr", + "steps": [{ + "args": "run main.ts", + "output": "main.out" + }, { + "cleanDenoDir": true, + "args": "info main.ts", + "output": "main_info.out" + }] +} diff --git a/tests/specs/jsr/deps/main.out b/tests/specs/jsr/deps/main.out new file mode 100644 index 000000000..621703c4b --- /dev/null +++ b/tests/specs/jsr/deps/main.out @@ -0,0 +1,13 @@ +Download http://127.0.0.1:4250/@denotest/deps/meta.json +Download http://127.0.0.1:4250/@denotest/deps/1.0.0_meta.json +Download http://127.0.0.1:4250/@denotest/module_graph/meta.json +Download http://127.0.0.1:4250/@denotest/no_module_graph/meta.json +Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0_meta.json +Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1_meta.json +[UNORDERED_START] +Download http://127.0.0.1:4250/@denotest/deps/1.0.0/mod.ts +Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts +Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1/mod.ts +Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1/TestClass.ts +[UNORDERED_END] +{ version: "0.1.1", other: Other {} } diff --git a/tests/specs/jsr/deps/main.ts b/tests/specs/jsr/deps/main.ts new file mode 100644 index 000000000..f48255299 --- /dev/null +++ b/tests/specs/jsr/deps/main.ts @@ -0,0 +1,3 @@ +import value from "jsr:@denotest/deps"; + +console.log(value); diff --git a/tests/specs/jsr/deps/main_info.out b/tests/specs/jsr/deps/main_info.out new file mode 100644 index 000000000..c4d412707 --- /dev/null +++ b/tests/specs/jsr/deps/main_info.out @@ -0,0 +1,22 @@ +Download http://127.0.0.1:4250/@denotest/deps/meta.json +Download http://127.0.0.1:4250/@denotest/deps/1.0.0_meta.json +Download http://127.0.0.1:4250/@denotest/module_graph/meta.json +Download http://127.0.0.1:4250/@denotest/no_module_graph/meta.json +Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0_meta.json +Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1_meta.json +[UNORDERED_START] +Download http://127.0.0.1:4250/@denotest/deps/1.0.0/mod.ts +Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts +Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1/mod.ts +Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1/TestClass.ts +[UNORDERED_END] +local: [WILDCARD]main.ts +type: TypeScript +dependencies: 4 unique +size: [WILDCARD] + +file:///[WILDCARD]main.ts ([WILDCARD]) +└─┬ http://127.0.0.1:4250/@denotest/deps/1.0.0/mod.ts ([WILDCARD]) + ├── http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts ([WILDCARD]) + └─┬ http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1/mod.ts ([WILDCARD]) + └── http://127.0.0.1:4250/@denotest/no_module_graph/0.1.1/TestClass.ts ([WILDCARD]) diff --git a/tests/specs/jsr/import_https_url/__test__.jsonc b/tests/specs/jsr/import_https_url/__test__.jsonc new file mode 100644 index 000000000..597b8e009 --- /dev/null +++ b/tests/specs/jsr/import_https_url/__test__.jsonc @@ -0,0 +1,13 @@ +{ + "base": "jsr", + "steps": [{ + "args": "run -A analyzable.ts", + "output": "analyzable.out", + "exitCode": 1 + }, { + "cleanDenoDir": true, + "args": "run -A nonanalyzable.ts", + "output": "nonanalyzable.out", + "exitCode": 1 + }] +} diff --git a/tests/specs/jsr/import_https_url/analyzable.out b/tests/specs/jsr/import_https_url/analyzable.out new file mode 100644 index 000000000..dd1ca58b4 --- /dev/null +++ b/tests/specs/jsr/import_https_url/analyzable.out @@ -0,0 +1,8 @@ +Download http://127.0.0.1:4250/@denotest/import-https-url/meta.json +Download http://127.0.0.1:4250/@denotest/import-https-url/1.0.0_meta.json +Download http://127.0.0.1:4250/@denotest/import-https-url/1.0.0/analyzable.ts +Download http://localhost:4545/welcome.ts +error: Uncaught (in promise) TypeError: Importing http://localhost:4545/welcome.ts blocked. JSR packages cannot import non-JSR remote modules for security reasons. +await import("http://localhost:4545/welcome.ts"); +^ + at async http://127.0.0.1:4250/@denotest/import-https-url/1.0.0/analyzable.ts:1:1 diff --git a/tests/specs/jsr/import_https_url/analyzable.ts b/tests/specs/jsr/import_https_url/analyzable.ts new file mode 100644 index 000000000..44382867f --- /dev/null +++ b/tests/specs/jsr/import_https_url/analyzable.ts @@ -0,0 +1 @@ +import "jsr:@denotest/import-https-url/analyzable"; diff --git a/tests/specs/jsr/import_https_url/nonanalyzable.out b/tests/specs/jsr/import_https_url/nonanalyzable.out new file mode 100644 index 000000000..4ae04996c --- /dev/null +++ b/tests/specs/jsr/import_https_url/nonanalyzable.out @@ -0,0 +1,7 @@ +Download http://127.0.0.1:4250/@denotest/import-https-url/meta.json +Download http://127.0.0.1:4250/@denotest/import-https-url/1.0.0_meta.json +Download http://127.0.0.1:4250/@denotest/import-https-url/1.0.0/unanalyzable.ts +error: Uncaught (in promise) TypeError: Importing http://localhost:4545/welcome.ts blocked. JSR packages cannot import non-JSR remote modules for security reasons. +await import(nonAnalyzableUrl()); +^ + at async http://127.0.0.1:4250/@denotest/import-https-url/1.0.0/unanalyzable.ts:5:1 diff --git a/tests/specs/jsr/import_https_url/nonanalyzable.ts b/tests/specs/jsr/import_https_url/nonanalyzable.ts new file mode 100644 index 000000000..87ccdcfdc --- /dev/null +++ b/tests/specs/jsr/import_https_url/nonanalyzable.ts @@ -0,0 +1 @@ +import "jsr:@denotest/import-https-url/unanalyzable"; diff --git a/tests/specs/jsr/jsx_with_no_pragmas/__test__.jsonc b/tests/specs/jsr/jsx_with_no_pragmas/__test__.jsonc new file mode 100644 index 000000000..c2a269ea6 --- /dev/null +++ b/tests/specs/jsr/jsx_with_no_pragmas/__test__.jsonc @@ -0,0 +1,6 @@ +{ + "base": "jsr", + "args": "run main.ts", + "output": "main.out", + "exitCode": 1 +} diff --git a/tests/specs/jsr/jsx_with_no_pragmas/main.out b/tests/specs/jsr/jsx_with_no_pragmas/main.out new file mode 100644 index 000000000..c3977fe22 --- /dev/null +++ b/tests/specs/jsr/jsx_with_no_pragmas/main.out @@ -0,0 +1,7 @@ +Download [WILDCARD] +error: Uncaught (in promise) ReferenceError: React is not defined + return renderToString(<div>foo.jsx</div>); + ^ + at render (http://127.0.0.1:4250/@denotest/jsx-with-no-pragmas/1.0.0/foo.jsx:4:25) + at render (http://127.0.0.1:4250/@denotest/jsx-with-no-pragmas/1.0.0/mod.ts:5:15) + at file:///[WILDCARD]/jsr/jsx_with_no_pragmas/main.ts:3:1 diff --git a/tests/specs/jsr/jsx_with_no_pragmas/main.ts b/tests/specs/jsr/jsx_with_no_pragmas/main.ts new file mode 100644 index 000000000..9d6e5a41e --- /dev/null +++ b/tests/specs/jsr/jsx_with_no_pragmas/main.ts @@ -0,0 +1,3 @@ +import { render } from "jsr:@denotest/jsx-with-no-pragmas@1.0.0"; + +render(); diff --git a/tests/specs/jsr/jsx_with_pragmas/__test__.jsonc b/tests/specs/jsr/jsx_with_pragmas/__test__.jsonc new file mode 100644 index 000000000..a6fa5c7c3 --- /dev/null +++ b/tests/specs/jsr/jsx_with_pragmas/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "base": "jsr", + "args": "run main.ts", + "output": "main.out" +} diff --git a/tests/specs/jsr/jsx_with_pragmas/main.out b/tests/specs/jsr/jsx_with_pragmas/main.out new file mode 100644 index 000000000..c149ba010 --- /dev/null +++ b/tests/specs/jsr/jsx_with_pragmas/main.out @@ -0,0 +1,3 @@ +Download [WILDCARD] +<div>foo.jsx</div> +<div>foo.tsx</div> diff --git a/tests/specs/jsr/jsx_with_pragmas/main.ts b/tests/specs/jsr/jsx_with_pragmas/main.ts new file mode 100644 index 000000000..4a38c56ad --- /dev/null +++ b/tests/specs/jsr/jsx_with_pragmas/main.ts @@ -0,0 +1,3 @@ +import { render } from "jsr:@denotest/jsx-with-pragmas@1.0.0"; + +render(); diff --git a/tests/specs/jsr/module_graph/__test__.jsonc b/tests/specs/jsr/module_graph/__test__.jsonc new file mode 100644 index 000000000..2528003b5 --- /dev/null +++ b/tests/specs/jsr/module_graph/__test__.jsonc @@ -0,0 +1,11 @@ +{ + "base": "jsr", + "steps": [{ + "args": "run main.ts", + "output": "main.out" + }, { + "cleanDenoDir": true, + "args": "info main.ts", + "output": "main_info.out" + }] +} diff --git a/tests/specs/jsr/module_graph/main.out b/tests/specs/jsr/module_graph/main.out new file mode 100644 index 000000000..1cd0115b9 --- /dev/null +++ b/tests/specs/jsr/module_graph/main.out @@ -0,0 +1,7 @@ +Download http://127.0.0.1:4250/@denotest/module_graph/meta.json +Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0_meta.json +[UNORDERED_START] +Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts +Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0/mod.ts +[UNORDERED_END] +Test { other: Other {} } diff --git a/tests/specs/jsr/module_graph/main.ts b/tests/specs/jsr/module_graph/main.ts new file mode 100644 index 000000000..c92823cc2 --- /dev/null +++ b/tests/specs/jsr/module_graph/main.ts @@ -0,0 +1,3 @@ +import { Test } from "jsr:@denotest/module_graph"; + +console.log(new Test()); diff --git a/tests/specs/jsr/module_graph/main_info.out b/tests/specs/jsr/module_graph/main_info.out new file mode 100644 index 000000000..c35cca5b4 --- /dev/null +++ b/tests/specs/jsr/module_graph/main_info.out @@ -0,0 +1,14 @@ +Download http://127.0.0.1:4250/@denotest/module_graph/meta.json +Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0_meta.json +[UNORDERED_START] +Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0/mod.ts +Download http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts +[UNORDERED_END] +local: [WILDCARD]main.ts +type: TypeScript +dependencies: 2 unique +size: [WILDCARD] + +file:///[WILDCARD]/module_graph/main.ts ([WILDCARD]) +└─┬ http://127.0.0.1:4250/@denotest/module_graph/1.4.0/mod.ts ([WILDCARD]) + └── http://127.0.0.1:4250/@denotest/module_graph/1.4.0/other.ts ([WILDCARD]) diff --git a/tests/specs/jsr/no_module_graph/__test__.jsonc b/tests/specs/jsr/no_module_graph/__test__.jsonc new file mode 100644 index 000000000..b3915ecef --- /dev/null +++ b/tests/specs/jsr/no_module_graph/__test__.jsonc @@ -0,0 +1,14 @@ +{ + "base": "jsr", + "steps": [{ + "args": "run main.ts", + "output": "main.out" + }, { + "cleanDenoDir": true, + "args": "info main.ts", + "output": "main_info.out" + }, { + "args": "run --quiet multiple.ts", + "output": "multiple.out" + }] +} diff --git a/tests/specs/jsr/no_module_graph/main.out b/tests/specs/jsr/no_module_graph/main.out new file mode 100644 index 000000000..da9b67e11 --- /dev/null +++ b/tests/specs/jsr/no_module_graph/main.out @@ -0,0 +1,6 @@ +Download http://127.0.0.1:4250/@denotest/no_module_graph/meta.json +Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0_meta.json +Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0/mod.ts +Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0/TestClass.ts +0.1.0 +TestClass {} diff --git a/tests/specs/jsr/no_module_graph/main.ts b/tests/specs/jsr/no_module_graph/main.ts new file mode 100644 index 000000000..6ea030c59 --- /dev/null +++ b/tests/specs/jsr/no_module_graph/main.ts @@ -0,0 +1,4 @@ +import version, { TestClass } from "jsr:@denotest/no_module_graph@0.1.0"; + +console.log(version); +console.log(new TestClass()); diff --git a/tests/specs/jsr/no_module_graph/main_info.out b/tests/specs/jsr/no_module_graph/main_info.out new file mode 100644 index 000000000..0293e4120 --- /dev/null +++ b/tests/specs/jsr/no_module_graph/main_info.out @@ -0,0 +1,12 @@ +Download http://127.0.0.1:4250/@denotest/no_module_graph/meta.json +Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0_meta.json +Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0/mod.ts +Download http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0/TestClass.ts +local: [WILDCARD]main.ts +type: TypeScript +dependencies: 2 unique +size: [WILDCARD] + +file:///[WILDCARD]/jsr/no_module_graph/main.ts ([WILDCARD]) +└─┬ http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0/mod.ts ([WILDCARD]) + └── http://127.0.0.1:4250/@denotest/no_module_graph/0.1.0/TestClass.ts ([WILDCARD]) diff --git a/tests/specs/jsr/no_module_graph/multiple.out b/tests/specs/jsr/no_module_graph/multiple.out new file mode 100644 index 000000000..8146276d0 --- /dev/null +++ b/tests/specs/jsr/no_module_graph/multiple.out @@ -0,0 +1,2 @@ +0.1.0 +0.2.0 diff --git a/tests/specs/jsr/no_module_graph/multiple.ts b/tests/specs/jsr/no_module_graph/multiple.ts new file mode 100644 index 000000000..660ed8be6 --- /dev/null +++ b/tests/specs/jsr/no_module_graph/multiple.ts @@ -0,0 +1,5 @@ +import version1 from "jsr:@denotest/no_module_graph@0.1.0"; +import version2 from "jsr:@denotest/no_module_graph@^0.2"; + +console.log(version1); +console.log(version2); diff --git a/tests/specs/jsr/subset_type_graph/__test__.jsonc b/tests/specs/jsr/subset_type_graph/__test__.jsonc new file mode 100644 index 000000000..85d04ed54 --- /dev/null +++ b/tests/specs/jsr/subset_type_graph/__test__.jsonc @@ -0,0 +1,6 @@ +{ + "base": "jsr", + "args": "check --all main.ts", + "output": "main.check.out", + "exitCode": 1 +} diff --git a/tests/specs/jsr/subset_type_graph/main.check.out b/tests/specs/jsr/subset_type_graph/main.check.out new file mode 100644 index 000000000..f46610c0a --- /dev/null +++ b/tests/specs/jsr/subset_type_graph/main.check.out @@ -0,0 +1,45 @@ +Download http://127.0.0.1:4250/@denotest/subset-type-graph/meta.json +Download http://127.0.0.1:4250/@denotest/subset-type-graph-invalid/meta.json +Download http://127.0.0.1:4250/@denotest/subset-type-graph/0.1.0_meta.json +Download http://127.0.0.1:4250/@denotest/subset-type-graph-invalid/0.1.0_meta.json +[UNORDERED_START] +Download http://127.0.0.1:4250/@denotest/subset-type-graph/0.1.0/mod.ts +Download http://127.0.0.1:4250/@denotest/subset-type-graph-invalid/0.1.0/mod.ts +[UNORDERED_END] +Check file:///[WILDCARD]/subset_type_graph/main.ts +error: TS2322 [ERROR]: Type 'string' is not assignable to type 'number'. +const invalidTypeCheck: number = ""; + ~~~~~~~~~~~~~~~~ + at http://127.0.0.1:4250/@denotest/subset-type-graph-invalid/0.1.0/mod.ts:11:7 + +TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const error1: string = new Foo1().method(); + ~~~~~~ + at file:///[WILDCARD]/subset_type_graph/main.ts:5:7 + +TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +const error2: string = new Foo2().method(); + ~~~~~~ + at file:///[WILDCARD]/subset_type_graph/main.ts:6:7 + +TS2551 [ERROR]: Property 'method2' does not exist on type 'Foo'. Did you mean 'method'? +new Foo1().method2(); + ~~~~~~~ + at file:///[WILDCARD]/subset_type_graph/main.ts:12:12 + + 'method' is declared here. + method(): number { + ~~~~~~ + at http://127.0.0.1:4250/@denotest/subset-type-graph/0.1.0/mod.ts:8:3 + +TS2551 [ERROR]: Property 'method2' does not exist on type 'Foo'. Did you mean 'method'? +new Foo2().method2(); + ~~~~~~~ + at file:///[WILDCARD]/subset_type_graph/main.ts:13:12 + + 'method' is declared here. + method() { + ~~~~~~ + at http://127.0.0.1:4250/@denotest/subset-type-graph-invalid/0.1.0/mod.ts:2:3 + +Found 5 errors. diff --git a/tests/specs/jsr/subset_type_graph/main.ts b/tests/specs/jsr/subset_type_graph/main.ts new file mode 100644 index 000000000..2fff966a7 --- /dev/null +++ b/tests/specs/jsr/subset_type_graph/main.ts @@ -0,0 +1,13 @@ +import { Foo as Foo1 } from "jsr:@denotest/subset-type-graph@0.1.0"; +import { Foo as Foo2 } from "jsr:@denotest/subset-type-graph-invalid@0.1.0"; + +// these will both raise type checking errors +const error1: string = new Foo1().method(); +const error2: string = new Foo2().method(); +console.log(error1); +console.log(error2); + +// now raise some errors that will show the original code and +// these should source map to the original +new Foo1().method2(); +new Foo2().method2(); diff --git a/tests/specs/jsr/version_not_found/__test__.jsonc b/tests/specs/jsr/version_not_found/__test__.jsonc new file mode 100644 index 000000000..36335985f --- /dev/null +++ b/tests/specs/jsr/version_not_found/__test__.jsonc @@ -0,0 +1,6 @@ +{ + "base": "jsr", + "args": "run -A main.ts", + "output": "main.out", + "exitCode": 1 +} diff --git a/tests/specs/jsr/version_not_found/main.out b/tests/specs/jsr/version_not_found/main.out new file mode 100644 index 000000000..6a32b5d81 --- /dev/null +++ b/tests/specs/jsr/version_not_found/main.out @@ -0,0 +1,5 @@ +Download http://127.0.0.1:4250/@denotest/deps/meta.json +Download http://127.0.0.1:4250/@denotest/deps/meta.json +error: Could not find constraint in the list of versions: @denotest/deps@0.1.4 + Specifier: jsr:@denotest/deps@0.1.4/mod.ts + at file:///[WILDCARD]/version_not_found/main.ts:1:19 diff --git a/tests/specs/jsr/version_not_found/main.ts b/tests/specs/jsr/version_not_found/main.ts new file mode 100644 index 000000000..a7673b744 --- /dev/null +++ b/tests/specs/jsr/version_not_found/main.ts @@ -0,0 +1,2 @@ +import value from "jsr:@denotest/deps@0.1.4/mod.ts"; +console.log(value); |