diff options
| author | David Sherret <dsherret@users.noreply.github.com> | 2024-01-10 17:40:30 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-10 22:40:30 +0000 |
| commit | 70ac06138c18cf643e7e1947dee54f3adff13de3 (patch) | |
| tree | 73cd8fb7fe51ecbdcf47770b15b27f6fb49b4d05 /cli/tests/testdata/publish | |
| parent | 515a34b4de222e35c7ade1b92614d746e73d4c2e (diff) | |
feat(unstable): fast subset type checking of JSR dependencies (#21873)
Diffstat (limited to 'cli/tests/testdata/publish')
23 files changed, 120 insertions, 2 deletions
diff --git a/cli/tests/testdata/publish/invalid_fast_check.out b/cli/tests/testdata/publish/invalid_fast_check.out new file mode 100644 index 000000000..ed731c1d1 --- /dev/null +++ b/cli/tests/testdata/publish/invalid_fast_check.out @@ -0,0 +1,8 @@ +Checking fast check type graph for errors... + +Missing explicit return type in the public API. + at file:///[WILDCARD]/publish/invalid_fast_check/mod.ts:2:17 + +Fixing these fast check errors is required to make the code fast check compatible which enables type checking your package's TypeScript code with the same performance as if you had distributed declaration files. Do any of these errors seem too restrictive or incorrect? Please open an issue if so to help us improve: https://github.com/denoland/deno/issues + +error: Had 1 fast check error. diff --git a/cli/tests/testdata/publish/invalid_fast_check/deno.json b/cli/tests/testdata/publish/invalid_fast_check/deno.json new file mode 100644 index 000000000..5826e5529 --- /dev/null +++ b/cli/tests/testdata/publish/invalid_fast_check/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.1.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/cli/tests/testdata/publish/invalid_fast_check/mod.ts b/cli/tests/testdata/publish/invalid_fast_check/mod.ts new file mode 100644 index 000000000..025311049 --- /dev/null +++ b/cli/tests/testdata/publish/invalid_fast_check/mod.ts @@ -0,0 +1,4 @@ +// requires an explicit type annotation of `number` +export function getRandom() { + return Math.random(); +} diff --git a/cli/tests/testdata/publish/javascript_decl_file.out b/cli/tests/testdata/publish/javascript_decl_file.out new file mode 100644 index 000000000..deb66eba0 --- /dev/null +++ b/cli/tests/testdata/publish/javascript_decl_file.out @@ -0,0 +1,6 @@ +Checking fast check type graph for errors... +Ensuring type checks... +Check file:///[WILDCARD]/javascript_decl_file/mod.js +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/cli/tests/testdata/publish/javascript_decl_file/deno.json b/cli/tests/testdata/publish/javascript_decl_file/deno.json new file mode 100644 index 000000000..e5dbfa8d3 --- /dev/null +++ b/cli/tests/testdata/publish/javascript_decl_file/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.js" + } +} diff --git a/cli/tests/testdata/publish/javascript_decl_file/mod.d.ts b/cli/tests/testdata/publish/javascript_decl_file/mod.d.ts new file mode 100644 index 000000000..b2f6c69a8 --- /dev/null +++ b/cli/tests/testdata/publish/javascript_decl_file/mod.d.ts @@ -0,0 +1 @@ +export function getRandom(): number; diff --git a/cli/tests/testdata/publish/javascript_decl_file/mod.js b/cli/tests/testdata/publish/javascript_decl_file/mod.js new file mode 100644 index 000000000..2395e622b --- /dev/null +++ b/cli/tests/testdata/publish/javascript_decl_file/mod.js @@ -0,0 +1,5 @@ +/// <reference types="./mod.d.ts" /> + +export function getRandom() { + return Math.random(); +} diff --git a/cli/tests/testdata/publish/javascript_missing_decl_file.out b/cli/tests/testdata/publish/javascript_missing_decl_file.out new file mode 100644 index 000000000..02478a5b5 --- /dev/null +++ b/cli/tests/testdata/publish/javascript_missing_decl_file.out @@ -0,0 +1,6 @@ +Checking fast check type graph for errors... +Warning Package '@foo/bar' is a JavaScript package without a corresponding declaration file. This may lead to a non-optimal experience for users of your package. For performance reasons, it's recommended to ship a corresponding TypeScript declaration file or to convert to TypeScript. +Ensuring type checks... +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/cli/tests/testdata/publish/javascript_missing_decl_file/deno.json b/cli/tests/testdata/publish/javascript_missing_decl_file/deno.json new file mode 100644 index 000000000..e12927c26 --- /dev/null +++ b/cli/tests/testdata/publish/javascript_missing_decl_file/deno.json @@ -0,0 +1,8 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.js", + "./other": "./other.js" + } +} diff --git a/cli/tests/testdata/publish/javascript_missing_decl_file/mod.js b/cli/tests/testdata/publish/javascript_missing_decl_file/mod.js new file mode 100644 index 000000000..4a62fa5b4 --- /dev/null +++ b/cli/tests/testdata/publish/javascript_missing_decl_file/mod.js @@ -0,0 +1,3 @@ +export function getRandom() { + return Math.random(); +} diff --git a/cli/tests/testdata/publish/javascript_missing_decl_file/other.js b/cli/tests/testdata/publish/javascript_missing_decl_file/other.js new file mode 100644 index 000000000..89ffb80ba --- /dev/null +++ b/cli/tests/testdata/publish/javascript_missing_decl_file/other.js @@ -0,0 +1,3 @@ +export function other() { + return Math.random(); +} diff --git a/cli/tests/testdata/publish/missing_deno_json/main.ts b/cli/tests/testdata/publish/missing_deno_json/main.ts new file mode 100644 index 000000000..8d9b8a22a --- /dev/null +++ b/cli/tests/testdata/publish/missing_deno_json/main.ts @@ -0,0 +1,3 @@ +export function add(a: number, b: number): number { + return a + b; +} diff --git a/cli/tests/testdata/publish/successful.out b/cli/tests/testdata/publish/successful.out index a6a6a9bd4..7dbe16807 100644 --- a/cli/tests/testdata/publish/successful.out +++ b/cli/tests/testdata/publish/successful.out @@ -1,3 +1,6 @@ +Checking fast check type graph for errors... +Ensuring type checks... +Check file:///[WILDCARD]/publish/successful/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/cli/tests/testdata/publish/successful/deno.json b/cli/tests/testdata/publish/successful/deno.json index 930f3aa08..fefab899b 100644 --- a/cli/tests/testdata/publish/successful/deno.json +++ b/cli/tests/testdata/publish/successful/deno.json @@ -5,6 +5,6 @@ ".": "./mod.ts" }, "imports": { - "@std/http": "jsr:@std/http@1" + "@std/http": "./std_http.ts" } } diff --git a/cli/tests/testdata/publish/successful/mod.ts b/cli/tests/testdata/publish/successful/mod.ts index 152bce40b..4bb6da255 100644 --- a/cli/tests/testdata/publish/successful/mod.ts +++ b/cli/tests/testdata/publish/successful/mod.ts @@ -1,5 +1,5 @@ import http from "@std/http"; -export function foobar() { +export function foobar(): { fileServer(): void } { return http.fileServer; } diff --git a/cli/tests/testdata/publish/successful/std_http.ts b/cli/tests/testdata/publish/successful/std_http.ts new file mode 100644 index 000000000..9d57b36f3 --- /dev/null +++ b/cli/tests/testdata/publish/successful/std_http.ts @@ -0,0 +1,6 @@ +// temp until we get jsr:@std/http in the test server +export default { + fileServer() { + console.log("Hi"); + }, +}; diff --git a/cli/tests/testdata/publish/workspace.out b/cli/tests/testdata/publish/workspace.out new file mode 100644 index 000000000..588c22bbc --- /dev/null +++ b/cli/tests/testdata/publish/workspace.out @@ -0,0 +1,11 @@ +Publishing a workspace... +Checking fast check type graph for errors... +Ensuring type checks... +Check file:///[WILDCARD]/workspace/foo/mod.ts +Check file:///[WILDCARD]/workspace/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 +Publishing @foo/foo@1.0.0 ... +Successfully published @foo/foo@1.0.0 +Visit http://127.0.0.1:4250/@foo/foo@1.0.0 for details diff --git a/cli/tests/testdata/publish/workspace/bar/deno.json b/cli/tests/testdata/publish/workspace/bar/deno.json new file mode 100644 index 000000000..213a7cec6 --- /dev/null +++ b/cli/tests/testdata/publish/workspace/bar/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/cli/tests/testdata/publish/workspace/bar/mod.ts b/cli/tests/testdata/publish/workspace/bar/mod.ts new file mode 100644 index 000000000..8d9b8a22a --- /dev/null +++ b/cli/tests/testdata/publish/workspace/bar/mod.ts @@ -0,0 +1,3 @@ +export function add(a: number, b: number): number { + return a + b; +} diff --git a/cli/tests/testdata/publish/workspace/deno.json b/cli/tests/testdata/publish/workspace/deno.json new file mode 100644 index 000000000..57602aab5 --- /dev/null +++ b/cli/tests/testdata/publish/workspace/deno.json @@ -0,0 +1,6 @@ +{ + "workspaces": [ + "foo", + "bar" + ] +} diff --git a/cli/tests/testdata/publish/workspace/foo/deno.json b/cli/tests/testdata/publish/workspace/foo/deno.json new file mode 100644 index 000000000..79563d36c --- /dev/null +++ b/cli/tests/testdata/publish/workspace/foo/deno.json @@ -0,0 +1,10 @@ +{ + "name": "@foo/foo", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + }, + "imports": { + "bar": "jsr:@foo/bar@1" + } +} diff --git a/cli/tests/testdata/publish/workspace/foo/mod.ts b/cli/tests/testdata/publish/workspace/foo/mod.ts new file mode 100644 index 000000000..adf584463 --- /dev/null +++ b/cli/tests/testdata/publish/workspace/foo/mod.ts @@ -0,0 +1,5 @@ +import * as bar from "bar"; + +export function add(a: number, b: number): number { + return bar.add(a, b); +} diff --git a/cli/tests/testdata/publish/workspace_individual.out b/cli/tests/testdata/publish/workspace_individual.out new file mode 100644 index 000000000..4eadb45af --- /dev/null +++ b/cli/tests/testdata/publish/workspace_individual.out @@ -0,0 +1,6 @@ +Checking fast check type graph for errors... +Ensuring type checks... +Check file:///[WILDCARD]/workspace/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 |
