diff options
Diffstat (limited to 'tests/testdata/publish')
48 files changed, 328 insertions, 0 deletions
diff --git a/tests/testdata/publish/deno_jsonc.out b/tests/testdata/publish/deno_jsonc.out new file mode 100644 index 000000000..2d5e4ffea --- /dev/null +++ b/tests/testdata/publish/deno_jsonc.out @@ -0,0 +1,6 @@ +Checking fast check type graph for errors... +Ensuring type checks... +Check file:///[WILDCARD]/publish/deno_jsonc/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/testdata/publish/deno_jsonc/deno.jsonc b/tests/testdata/publish/deno_jsonc/deno.jsonc new file mode 100644 index 000000000..4c9dfb08c --- /dev/null +++ b/tests/testdata/publish/deno_jsonc/deno.jsonc @@ -0,0 +1,11 @@ +{ + // It's .jsonc file so it can have comments + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + }, + "imports": { + "@std/http": "./std_http.ts" + } +} diff --git a/tests/testdata/publish/deno_jsonc/mod.ts b/tests/testdata/publish/deno_jsonc/mod.ts new file mode 100644 index 000000000..4bb6da255 --- /dev/null +++ b/tests/testdata/publish/deno_jsonc/mod.ts @@ -0,0 +1,5 @@ +import http from "@std/http"; + +export function foobar(): { fileServer(): void } { + return http.fileServer; +} diff --git a/tests/testdata/publish/deno_jsonc/std_http.ts b/tests/testdata/publish/deno_jsonc/std_http.ts new file mode 100644 index 000000000..9d57b36f3 --- /dev/null +++ b/tests/testdata/publish/deno_jsonc/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/tests/testdata/publish/dry_run.out b/tests/testdata/publish/dry_run.out new file mode 100644 index 000000000..f9f4df72e --- /dev/null +++ b/tests/testdata/publish/dry_run.out @@ -0,0 +1,4 @@ +Checking fast check type graph for errors... +Ensuring type checks... +Check [WILDCARD] +Warning Aborting due to --dry-run diff --git a/tests/testdata/publish/invalid_fast_check.out b/tests/testdata/publish/invalid_fast_check.out new file mode 100644 index 000000000..d18be45fe --- /dev/null +++ b/tests/testdata/publish/invalid_fast_check.out @@ -0,0 +1,16 @@ +Checking fast check type graph for errors... +error[zap-missing-explicit-return-type]: missing explicit return type in the public API + --> [WILDCARD]mod.ts:2:17 + | +2 | export function getRandom() { + | ^^^^^^^^^ 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/zap-missing-explicit-return-type + +This package contains Zap errors. Although conforming to Zap will +significantly improve the type checking performance of your library, +you can choose to skip it by providing the --no-zap flag. + +error: Found 1 problem diff --git a/tests/testdata/publish/invalid_fast_check/deno.json b/tests/testdata/publish/invalid_fast_check/deno.json new file mode 100644 index 000000000..5826e5529 --- /dev/null +++ b/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/tests/testdata/publish/invalid_fast_check/mod.ts b/tests/testdata/publish/invalid_fast_check/mod.ts new file mode 100644 index 000000000..025311049 --- /dev/null +++ b/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/tests/testdata/publish/invalid_import.out b/tests/testdata/publish/invalid_import.out new file mode 100644 index 000000000..ca9d20eed --- /dev/null +++ b/tests/testdata/publish/invalid_import.out @@ -0,0 +1,32 @@ +Download http://localhost:4545/welcome.ts +Download http://localhost:4545/echo.ts +Download http://localhost:4545/npm/registry/chalk +Download http://localhost:4545/npm/registry/chalk/chalk-5.0.1.tgz +Checking fast check type graph for errors... +Ensuring type checks... +Check file://[WILDCARD]mod.ts +error[invalid-external-import]: invalid import to a non-JSR 'http' specifier + --> [WILDCARD]mod.ts:1:8 + | +1 | import "http://localhost:4545/welcome.ts"; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the specifier + = hint: replace this import with one from jsr or npm, or vendor the dependency into your package + + info: the import was resolved to 'http://localhost:4545/welcome.ts' + info: this specifier is not allowed to be imported on jsr + info: jsr only supports importing `jsr:`, `npm:`, and `data:` specifiers + docs: https://jsr.io/go/invalid-external-import + +error[invalid-external-import]: invalid import to a non-JSR 'http' specifier + --> [WILDCARD]mod.ts:2:8 + | +2 | import "$echo"; + | ^^^^^^^ the specifier + = hint: replace this import with one from jsr or npm, or vendor the dependency into your package + + info: the import was resolved to 'http://localhost:4545/echo.ts' + info: this specifier is not allowed to be imported on jsr + info: jsr only supports importing `jsr:`, `npm:`, and `data:` specifiers + docs: https://jsr.io/go/invalid-external-import + +error: Found 2 problems diff --git a/tests/testdata/publish/invalid_import/deno.json b/tests/testdata/publish/invalid_import/deno.json new file mode 100644 index 000000000..49b666d22 --- /dev/null +++ b/tests/testdata/publish/invalid_import/deno.json @@ -0,0 +1,10 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "imports": { + "$echo": "http://localhost:4545/echo.ts" + }, + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/testdata/publish/invalid_import/mod.ts b/tests/testdata/publish/invalid_import/mod.ts new file mode 100644 index 000000000..bdaf010e2 --- /dev/null +++ b/tests/testdata/publish/invalid_import/mod.ts @@ -0,0 +1,9 @@ +import "http://localhost:4545/welcome.ts"; +import "$echo"; + +import "data:application/javascript,console.log(1)"; +import "npm:chalk@5"; + +export function foobar(): string { + return "string"; +} diff --git a/tests/testdata/publish/invalid_path.out b/tests/testdata/publish/invalid_path.out new file mode 100644 index 000000000..cd3e92e0c --- /dev/null +++ b/tests/testdata/publish/invalid_path.out @@ -0,0 +1,11 @@ +Checking fast check type graph for errors... +Ensuring type checks... +Check file://[WILDCARD]mod.ts +error[invalid-path]: package path must not contain whitespace (found ' ') + --> [WILDCARD]path with spaces.txt + = hint: rename or remove the file, or add it to 'publish.exclude' in the config file + + info: to portably support all platforms, including windows, the allowed characters in package paths are limited + docs: https://jsr.io/go/invalid-path + +error: Found 1 problem diff --git a/tests/testdata/publish/invalid_path/deno.json b/tests/testdata/publish/invalid_path/deno.json new file mode 100644 index 000000000..213a7cec6 --- /dev/null +++ b/tests/testdata/publish/invalid_path/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/testdata/publish/invalid_path/mod.ts b/tests/testdata/publish/invalid_path/mod.ts new file mode 100644 index 000000000..9e217d9b0 --- /dev/null +++ b/tests/testdata/publish/invalid_path/mod.ts @@ -0,0 +1,3 @@ +export function foobar(): string { + return "string"; +} diff --git a/tests/testdata/publish/invalid_path/path with spaces.txt b/tests/testdata/publish/invalid_path/path with spaces.txt new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/testdata/publish/invalid_path/path with spaces.txt diff --git a/tests/testdata/publish/javascript_decl_file.out b/tests/testdata/publish/javascript_decl_file.out new file mode 100644 index 000000000..deb66eba0 --- /dev/null +++ b/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/tests/testdata/publish/javascript_decl_file/deno.json b/tests/testdata/publish/javascript_decl_file/deno.json new file mode 100644 index 000000000..e5dbfa8d3 --- /dev/null +++ b/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/tests/testdata/publish/javascript_decl_file/mod.d.ts b/tests/testdata/publish/javascript_decl_file/mod.d.ts new file mode 100644 index 000000000..b2f6c69a8 --- /dev/null +++ b/tests/testdata/publish/javascript_decl_file/mod.d.ts @@ -0,0 +1 @@ +export function getRandom(): number; diff --git a/tests/testdata/publish/javascript_decl_file/mod.js b/tests/testdata/publish/javascript_decl_file/mod.js new file mode 100644 index 000000000..2395e622b --- /dev/null +++ b/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/tests/testdata/publish/javascript_missing_decl_file.out b/tests/testdata/publish/javascript_missing_decl_file.out new file mode 100644 index 000000000..557451b29 --- /dev/null +++ b/tests/testdata/publish/javascript_missing_decl_file.out @@ -0,0 +1,12 @@ +Checking fast check type graph for errors... +warning[zap-unsupported-javascript-entrypoint]: used a JavaScript module without type declarations as an entrypoints + --> [WILDCARD]mod.js + = hint: add a type declaration (d.ts) for the JavaScript module, or rewrite it to TypeScript + + info: JavaScript files with no corresponding declaration require type inference to be type checked + info: fast check avoids type inference, so JavaScript entrypoints should be avoided + docs: https://jsr.io/go/zap-unsupported-javascript-entrypoint + +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/testdata/publish/javascript_missing_decl_file/deno.json b/tests/testdata/publish/javascript_missing_decl_file/deno.json new file mode 100644 index 000000000..e12927c26 --- /dev/null +++ b/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/tests/testdata/publish/javascript_missing_decl_file/mod.js b/tests/testdata/publish/javascript_missing_decl_file/mod.js new file mode 100644 index 000000000..4a62fa5b4 --- /dev/null +++ b/tests/testdata/publish/javascript_missing_decl_file/mod.js @@ -0,0 +1,3 @@ +export function getRandom() { + return Math.random(); +} diff --git a/tests/testdata/publish/javascript_missing_decl_file/other.js b/tests/testdata/publish/javascript_missing_decl_file/other.js new file mode 100644 index 000000000..89ffb80ba --- /dev/null +++ b/tests/testdata/publish/javascript_missing_decl_file/other.js @@ -0,0 +1,3 @@ +export function other() { + return Math.random(); +} diff --git a/tests/testdata/publish/missing_deno_json.out b/tests/testdata/publish/missing_deno_json.out new file mode 100644 index 000000000..adb472c71 --- /dev/null +++ b/tests/testdata/publish/missing_deno_json.out @@ -0,0 +1 @@ +error: Couldn't find a deno.json or a deno.jsonc configuration file in [WILDCARD]
\ No newline at end of file diff --git a/tests/testdata/publish/missing_deno_json/main.ts b/tests/testdata/publish/missing_deno_json/main.ts new file mode 100644 index 000000000..8d9b8a22a --- /dev/null +++ b/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/tests/testdata/publish/no_token.out b/tests/testdata/publish/no_token.out new file mode 100644 index 000000000..41415094c --- /dev/null +++ b/tests/testdata/publish/no_token.out @@ -0,0 +1 @@ +error: No means to authenticate. Pass a token to `--token`[WILDCARD] diff --git a/tests/testdata/publish/no_zap.out b/tests/testdata/publish/no_zap.out new file mode 100644 index 000000000..109964903 --- /dev/null +++ b/tests/testdata/publish/no_zap.out @@ -0,0 +1,5 @@ +Ensuring type checks... +Check file:///[WILDCARD]/mod.ts +Publishing @foo/bar@1.1.0 ... +Successfully published @foo/bar@1.1.0 +Visit http://127.0.0.1:4250/@foo/bar@1.1.0 for details diff --git a/tests/testdata/publish/node_specifier.out b/tests/testdata/publish/node_specifier.out new file mode 100644 index 000000000..7acb5b5ba --- /dev/null +++ b/tests/testdata/publish/node_specifier.out @@ -0,0 +1,8 @@ +Checking fast check type graph for errors... +Ensuring type checks... +Download http://localhost:4545/npm/registry/@types/node +Download http://localhost:4545/npm/registry/@types/node/node-[WILDCARD].tgz +Check file:///[WILDCARD]/publish/node_specifier/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/testdata/publish/node_specifier/deno.json b/tests/testdata/publish/node_specifier/deno.json new file mode 100644 index 000000000..213a7cec6 --- /dev/null +++ b/tests/testdata/publish/node_specifier/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/testdata/publish/node_specifier/mod.ts b/tests/testdata/publish/node_specifier/mod.ts new file mode 100644 index 000000000..9d8263709 --- /dev/null +++ b/tests/testdata/publish/node_specifier/mod.ts @@ -0,0 +1,5 @@ +import "node:http"; + +export function foobar(): string { + return "string"; +} diff --git a/tests/testdata/publish/successful.out b/tests/testdata/publish/successful.out new file mode 100644 index 000000000..7dbe16807 --- /dev/null +++ b/tests/testdata/publish/successful.out @@ -0,0 +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/tests/testdata/publish/successful/deno.json b/tests/testdata/publish/successful/deno.json new file mode 100644 index 000000000..fefab899b --- /dev/null +++ b/tests/testdata/publish/successful/deno.json @@ -0,0 +1,10 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + }, + "imports": { + "@std/http": "./std_http.ts" + } +} diff --git a/tests/testdata/publish/successful/mod.ts b/tests/testdata/publish/successful/mod.ts new file mode 100644 index 000000000..4bb6da255 --- /dev/null +++ b/tests/testdata/publish/successful/mod.ts @@ -0,0 +1,5 @@ +import http from "@std/http"; + +export function foobar(): { fileServer(): void } { + return http.fileServer; +} diff --git a/tests/testdata/publish/successful/std_http.ts b/tests/testdata/publish/successful/std_http.ts new file mode 100644 index 000000000..9d57b36f3 --- /dev/null +++ b/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/tests/testdata/publish/symlink.out b/tests/testdata/publish/symlink.out new file mode 100644 index 000000000..d226fa18e --- /dev/null +++ b/tests/testdata/publish/symlink.out @@ -0,0 +1,12 @@ +Checking fast check type graph for errors... +Ensuring type checks... +Check [WILDCARD]mod.ts +warning[unsupported-file-type]: unsupported file type 'symlink' + --> [WILDCARD]symlink + = hint: remove the file, or add it to 'publish.exclude' in the config file + + info: only files and directories are supported + info: the file was ignored and will not be published + docs: https://jsr.io/go/unsupported-file-type + +Warning Aborting due to --dry-run diff --git a/tests/testdata/publish/symlink/deno.json b/tests/testdata/publish/symlink/deno.json new file mode 100644 index 000000000..213a7cec6 --- /dev/null +++ b/tests/testdata/publish/symlink/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/testdata/publish/symlink/mod.ts b/tests/testdata/publish/symlink/mod.ts new file mode 100644 index 000000000..9e217d9b0 --- /dev/null +++ b/tests/testdata/publish/symlink/mod.ts @@ -0,0 +1,3 @@ +export function foobar(): string { + return "string"; +} diff --git a/tests/testdata/publish/symlink/symlink b/tests/testdata/publish/symlink/symlink new file mode 120000 index 000000000..0df9bcd04 --- /dev/null +++ b/tests/testdata/publish/symlink/symlink @@ -0,0 +1 @@ +./mod.ts
\ No newline at end of file diff --git a/tests/testdata/publish/unanalyzable_dynamic_import.out b/tests/testdata/publish/unanalyzable_dynamic_import.out new file mode 100644 index 000000000..3be7ece87 --- /dev/null +++ b/tests/testdata/publish/unanalyzable_dynamic_import.out @@ -0,0 +1,16 @@ +Checking fast check type graph for errors... +Ensuring type checks... +Check file://[WILDCARD]/mod.ts +warning[unanalyzable-dynamic-import]: unable to analyze dynamic import + --> [WILDCARD]mod.ts:1:7 + | +1 | await import("asd " + asd); + | ^^^^^^^^^^^^^^^^^^^^ the unanalyzable dynamic import + + info: after publishing this package, imports from the local import map do not work + info: dynamic imports that can not be analyzed at publish time will not be rewritten automatically + info: make sure the dynamic import is resolvable at runtime without an import map + +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/testdata/publish/unanalyzable_dynamic_import/deno.json b/tests/testdata/publish/unanalyzable_dynamic_import/deno.json new file mode 100644 index 000000000..213a7cec6 --- /dev/null +++ b/tests/testdata/publish/unanalyzable_dynamic_import/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/testdata/publish/unanalyzable_dynamic_import/mod.ts b/tests/testdata/publish/unanalyzable_dynamic_import/mod.ts new file mode 100644 index 000000000..fd53cb2c8 --- /dev/null +++ b/tests/testdata/publish/unanalyzable_dynamic_import/mod.ts @@ -0,0 +1 @@ +await import("asd " + asd); diff --git a/tests/testdata/publish/workspace.out b/tests/testdata/publish/workspace.out new file mode 100644 index 000000000..588c22bbc --- /dev/null +++ b/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/tests/testdata/publish/workspace/bar/deno.json b/tests/testdata/publish/workspace/bar/deno.json new file mode 100644 index 000000000..213a7cec6 --- /dev/null +++ b/tests/testdata/publish/workspace/bar/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/testdata/publish/workspace/bar/mod.ts b/tests/testdata/publish/workspace/bar/mod.ts new file mode 100644 index 000000000..8d9b8a22a --- /dev/null +++ b/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/tests/testdata/publish/workspace/deno.json b/tests/testdata/publish/workspace/deno.json new file mode 100644 index 000000000..57602aab5 --- /dev/null +++ b/tests/testdata/publish/workspace/deno.json @@ -0,0 +1,6 @@ +{ + "workspaces": [ + "foo", + "bar" + ] +} diff --git a/tests/testdata/publish/workspace/foo/deno.json b/tests/testdata/publish/workspace/foo/deno.json new file mode 100644 index 000000000..79563d36c --- /dev/null +++ b/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/tests/testdata/publish/workspace/foo/mod.ts b/tests/testdata/publish/workspace/foo/mod.ts new file mode 100644 index 000000000..adf584463 --- /dev/null +++ b/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/tests/testdata/publish/workspace_individual.out b/tests/testdata/publish/workspace_individual.out new file mode 100644 index 000000000..4eadb45af --- /dev/null +++ b/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 |
