diff options
Diffstat (limited to 'tests/specs/publish')
110 files changed, 792 insertions, 0 deletions
diff --git a/tests/specs/publish/allow_slow_types/__test__.jsonc b/tests/specs/publish/allow_slow_types/__test__.jsonc new file mode 100644 index 000000000..e9f1cd011 --- /dev/null +++ b/tests/specs/publish/allow_slow_types/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --allow-slow-types --token 'sadfasdf'", + "output": "allow_slow_types.out", + "exitCode": 0 +} diff --git a/tests/specs/publish/allow_slow_types/allow_slow_types.out b/tests/specs/publish/allow_slow_types/allow_slow_types.out new file mode 100644 index 000000000..cd22c0ce7 --- /dev/null +++ b/tests/specs/publish/allow_slow_types/allow_slow_types.out @@ -0,0 +1,5 @@ +Check file:///[WILDCARD]mod.ts +Warning Publishing a library with slow types is not recommended. This may lead to poor type checking performance for users of your package, may affect the quality of automatic documentation generation, and your package will not be shipped with a .d.ts file for Node.js users. +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/specs/publish/allow_slow_types/deno.json b/tests/specs/publish/allow_slow_types/deno.json new file mode 100644 index 000000000..5826e5529 --- /dev/null +++ b/tests/specs/publish/allow_slow_types/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.1.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/specs/publish/allow_slow_types/mod.ts b/tests/specs/publish/allow_slow_types/mod.ts new file mode 100644 index 000000000..025311049 --- /dev/null +++ b/tests/specs/publish/allow_slow_types/mod.ts @@ -0,0 +1,4 @@ +// requires an explicit type annotation of `number` +export function getRandom() { + return Math.random(); +} diff --git a/tests/specs/publish/bare_node_builtins/__test__.jsonc b/tests/specs/publish/bare_node_builtins/__test__.jsonc new file mode 100644 index 000000000..f9e38fbe5 --- /dev/null +++ b/tests/specs/publish/bare_node_builtins/__test__.jsonc @@ -0,0 +1,17 @@ +{ + "tempDir": true, + "envs": { + "DISABLE_JSR_PROVENANCE": "true", + "DENO_TESTING_DISABLE_GIT_CHECK": "1" + }, + "steps": [{ + "args": "publish --token 'sadfasdf' --dry-run --unstable-bare-node-builtins", + "output": "bare_node_builtins.out" + }, { + "envs": { + "DENO_DISABLE_PEDANTIC_NODE_WARNINGS": "1" + }, + "args": "publish --token 'sadfasdf' --dry-run --unstable-bare-node-builtins", + "output": "no_warnings.out" + }] +} diff --git a/tests/specs/publish/bare_node_builtins/bare_node_builtins.out b/tests/specs/publish/bare_node_builtins/bare_node_builtins.out new file mode 100644 index 000000000..09acc639f --- /dev/null +++ b/tests/specs/publish/bare_node_builtins/bare_node_builtins.out @@ -0,0 +1,11 @@ +Warning: Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix. +Warning: Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix. +Download http://localhost:4545/npm/registry/@types/node +Download http://localhost:4545/npm/registry/@types/node/node-18.16.19.tgz +Check file:///[WILDLINE]/mod.ts +Checking for slow types in the public API... +Check file:///[WILDLINE]/mod.ts +Simulating publish of @foo/bar@1.0.0 with files: + file:///[WILDLINE]/deno.json (87B) + file:///[WILDLINE]/mod.ts (121B) +Warning Aborting due to --dry-run diff --git a/tests/specs/publish/bare_node_builtins/deno.json b/tests/specs/publish/bare_node_builtins/deno.json new file mode 100644 index 000000000..213a7cec6 --- /dev/null +++ b/tests/specs/publish/bare_node_builtins/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/specs/publish/bare_node_builtins/mod.ts b/tests/specs/publish/bare_node_builtins/mod.ts new file mode 100644 index 000000000..04374d8b7 --- /dev/null +++ b/tests/specs/publish/bare_node_builtins/mod.ts @@ -0,0 +1,5 @@ +import * as url from "url"; + +export function foobar(): { href: string } { + return url.pathToFileURL("/foo/bar"); +} diff --git a/tests/specs/publish/bare_node_builtins/no_warnings.out b/tests/specs/publish/bare_node_builtins/no_warnings.out new file mode 100644 index 000000000..f9a11f37c --- /dev/null +++ b/tests/specs/publish/bare_node_builtins/no_warnings.out @@ -0,0 +1,5 @@ +Checking for slow types in the public API... +Simulating publish of @foo/bar@1.0.0 with files: + file:///[WILDLINE]/deno.json (87B) + file:///[WILDLINE]/mod.ts (121B) +Warning Aborting due to --dry-run diff --git a/tests/specs/publish/config_file_jsonc/__test__.jsonc b/tests/specs/publish/config_file_jsonc/__test__.jsonc new file mode 100644 index 000000000..bef8ce4ca --- /dev/null +++ b/tests/specs/publish/config_file_jsonc/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "deno_jsonc.out" +} diff --git a/tests/specs/publish/config_file_jsonc/deno.jsonc b/tests/specs/publish/config_file_jsonc/deno.jsonc new file mode 100644 index 000000000..4c9dfb08c --- /dev/null +++ b/tests/specs/publish/config_file_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/specs/publish/config_file_jsonc/deno_jsonc.out b/tests/specs/publish/config_file_jsonc/deno_jsonc.out new file mode 100644 index 000000000..af45ed598 --- /dev/null +++ b/tests/specs/publish/config_file_jsonc/deno_jsonc.out @@ -0,0 +1,6 @@ +Check file:///[WILDCARD]/mod.ts +Checking for slow types in the public API... +Check file:///[WILDCARD]/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/config_file_jsonc/mod.ts b/tests/specs/publish/config_file_jsonc/mod.ts new file mode 100644 index 000000000..6e8a61bae --- /dev/null +++ b/tests/specs/publish/config_file_jsonc/mod.ts @@ -0,0 +1,7 @@ +import http from "@std/http"; + +export function foobar(): { fileServer(): void } { + return { + fileServer: http.fileServer, + }; +} diff --git a/tests/specs/publish/config_file_jsonc/std_http.ts b/tests/specs/publish/config_file_jsonc/std_http.ts new file mode 100644 index 000000000..9d57b36f3 --- /dev/null +++ b/tests/specs/publish/config_file_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/specs/publish/config_flag/__test__.jsonc b/tests/specs/publish/config_flag/__test__.jsonc new file mode 100644 index 000000000..289f9abc9 --- /dev/null +++ b/tests/specs/publish/config_flag/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf' --config=successful/deno.json", + "output": "successful.out" +} diff --git a/tests/specs/publish/config_flag/successful.out b/tests/specs/publish/config_flag/successful.out new file mode 100644 index 000000000..78265361a --- /dev/null +++ b/tests/specs/publish/config_flag/successful.out @@ -0,0 +1,6 @@ +Check file:///[WILDCARD]/successful/mod.ts +Checking for slow types in the public API... +Check file:///[WILDCARD]/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/specs/publish/config_flag/successful/deno.json b/tests/specs/publish/config_flag/successful/deno.json new file mode 100644 index 000000000..fefab899b --- /dev/null +++ b/tests/specs/publish/config_flag/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/specs/publish/config_flag/successful/mod.ts b/tests/specs/publish/config_flag/successful/mod.ts new file mode 100644 index 000000000..6e8a61bae --- /dev/null +++ b/tests/specs/publish/config_flag/successful/mod.ts @@ -0,0 +1,7 @@ +import http from "@std/http"; + +export function foobar(): { fileServer(): void } { + return { + fileServer: http.fileServer, + }; +} diff --git a/tests/specs/publish/config_flag/successful/std_http.ts b/tests/specs/publish/config_flag/successful/std_http.ts new file mode 100644 index 000000000..9d57b36f3 --- /dev/null +++ b/tests/specs/publish/config_flag/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/specs/publish/dry_run/__test__.jsonc b/tests/specs/publish/dry_run/__test__.jsonc new file mode 100644 index 000000000..3ca6ff4d3 --- /dev/null +++ b/tests/specs/publish/dry_run/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf' --dry-run", + "output": "dry_run.out" +} diff --git a/tests/specs/publish/dry_run/deno.json b/tests/specs/publish/dry_run/deno.json new file mode 100644 index 000000000..fefab899b --- /dev/null +++ b/tests/specs/publish/dry_run/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/specs/publish/dry_run/dry_run.out b/tests/specs/publish/dry_run/dry_run.out new file mode 100644 index 000000000..afc2ba66a --- /dev/null +++ b/tests/specs/publish/dry_run/dry_run.out @@ -0,0 +1,8 @@ +Check file:///[WILDCARD]/mod.ts +Checking for slow types in the public API... +Check file:///[WILDCARD]/mod.ts +Simulating publish of @foo/bar@1.0.0 with files: + [WILDCARD]deno.json (140B) + [WILDCARD]mod.ts (137B) + [WILDCARD]std_http.ts (119B) +Warning Aborting due to --dry-run diff --git a/tests/specs/publish/dry_run/mod.ts b/tests/specs/publish/dry_run/mod.ts new file mode 100644 index 000000000..6e8a61bae --- /dev/null +++ b/tests/specs/publish/dry_run/mod.ts @@ -0,0 +1,7 @@ +import http from "@std/http"; + +export function foobar(): { fileServer(): void } { + return { + fileServer: http.fileServer, + }; +} diff --git a/tests/specs/publish/dry_run/std_http.ts b/tests/specs/publish/dry_run/std_http.ts new file mode 100644 index 000000000..9d57b36f3 --- /dev/null +++ b/tests/specs/publish/dry_run/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/specs/publish/has_slow_types/__test__.jsonc b/tests/specs/publish/has_slow_types/__test__.jsonc new file mode 100644 index 000000000..470bae81b --- /dev/null +++ b/tests/specs/publish/has_slow_types/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "has_slow_types.out", + "exitCode": 1 +} diff --git a/tests/specs/publish/has_slow_types/deno.json b/tests/specs/publish/has_slow_types/deno.json new file mode 100644 index 000000000..5826e5529 --- /dev/null +++ b/tests/specs/publish/has_slow_types/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.1.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/specs/publish/has_slow_types/has_slow_types.out b/tests/specs/publish/has_slow_types/has_slow_types.out new file mode 100644 index 000000000..43ac86658 --- /dev/null +++ b/tests/specs/publish/has_slow_types/has_slow_types.out @@ -0,0 +1,22 @@ +Check file:///[WILDCARD]/mod.ts +Checking for slow types in the public API... +error[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/slow-type-missing-explicit-return-type + +This package contains errors for slow types. Fixing these errors will: + + 1. Significantly improve your package users' type checking performance. + 2. Improve the automatic documentation generation. + 3. Enable automatic .d.ts generation for Node.js. + +Don't want to bother? You can choose to skip this step by +providing the --allow-slow-types flag. + +error: Found 1 problem diff --git a/tests/specs/publish/has_slow_types/mod.ts b/tests/specs/publish/has_slow_types/mod.ts new file mode 100644 index 000000000..025311049 --- /dev/null +++ b/tests/specs/publish/has_slow_types/mod.ts @@ -0,0 +1,4 @@ +// requires an explicit type annotation of `number` +export function getRandom() { + return Math.random(); +} diff --git a/tests/specs/publish/invalid_import/__test__.jsonc b/tests/specs/publish/invalid_import/__test__.jsonc new file mode 100644 index 000000000..5436a04f8 --- /dev/null +++ b/tests/specs/publish/invalid_import/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf' --dry-run", + "output": "invalid_import.out", + "exitCode": 1 +} diff --git a/tests/specs/publish/invalid_import/deno.json b/tests/specs/publish/invalid_import/deno.json new file mode 100644 index 000000000..49b666d22 --- /dev/null +++ b/tests/specs/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/specs/publish/invalid_import/invalid_import.out b/tests/specs/publish/invalid_import/invalid_import.out new file mode 100644 index 000000000..f6742de95 --- /dev/null +++ b/tests/specs/publish/invalid_import/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 +Check file:///[WILDCARD]/mod.ts +Checking for slow types in the public API... +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/specs/publish/invalid_import/mod.ts b/tests/specs/publish/invalid_import/mod.ts new file mode 100644 index 000000000..bdaf010e2 --- /dev/null +++ b/tests/specs/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/specs/publish/invalid_import_esm_sh_suggestion/__test__.jsonc b/tests/specs/publish/invalid_import_esm_sh_suggestion/__test__.jsonc new file mode 100644 index 000000000..6a6c3bdec --- /dev/null +++ b/tests/specs/publish/invalid_import_esm_sh_suggestion/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf' --dry-run", + "output": "invalid_import_esm_sh_suggestion.out", + "exitCode": 1 +} diff --git a/tests/specs/publish/invalid_import_esm_sh_suggestion/deno.json b/tests/specs/publish/invalid_import_esm_sh_suggestion/deno.json new file mode 100644 index 000000000..49b666d22 --- /dev/null +++ b/tests/specs/publish/invalid_import_esm_sh_suggestion/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/specs/publish/invalid_import_esm_sh_suggestion/invalid_import_esm_sh_suggestion.out b/tests/specs/publish/invalid_import_esm_sh_suggestion/invalid_import_esm_sh_suggestion.out new file mode 100644 index 000000000..a014f3de6 --- /dev/null +++ b/tests/specs/publish/invalid_import_esm_sh_suggestion/invalid_import_esm_sh_suggestion.out @@ -0,0 +1,20 @@ +[WILDCARD] +Check file:///[WILDCARD]/mod.ts +Checking for slow types in the public API... +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://esm.sh/react-dom@18.2.0/server"; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the specifier + = hint: replace this import with one from jsr or npm, or vendor the dependency into your package + | +1 | "npm:react-dom@18.2.0" + | ---------------------- try this specifier + + info: the import was resolved to 'http://esm.sh/react-dom@18.2.0/server' + 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 1 problem diff --git a/tests/specs/publish/invalid_import_esm_sh_suggestion/mod.ts b/tests/specs/publish/invalid_import_esm_sh_suggestion/mod.ts new file mode 100644 index 000000000..e597218ed --- /dev/null +++ b/tests/specs/publish/invalid_import_esm_sh_suggestion/mod.ts @@ -0,0 +1,5 @@ +import "http://esm.sh/react-dom@18.2.0/server"; + +export function foobar(): string { + return "string"; +} diff --git a/tests/specs/publish/invalid_path/__test__.jsonc b/tests/specs/publish/invalid_path/__test__.jsonc new file mode 100644 index 000000000..24f9c0dfa --- /dev/null +++ b/tests/specs/publish/invalid_path/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "invalid_path.out", + "exitCode": 1 +} diff --git a/tests/specs/publish/invalid_path/deno.json b/tests/specs/publish/invalid_path/deno.json new file mode 100644 index 000000000..213a7cec6 --- /dev/null +++ b/tests/specs/publish/invalid_path/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/specs/publish/invalid_path/invalid_path.out b/tests/specs/publish/invalid_path/invalid_path.out new file mode 100644 index 000000000..d47cb01de --- /dev/null +++ b/tests/specs/publish/invalid_path/invalid_path.out @@ -0,0 +1,11 @@ +Check file://[WILDCARD]mod.ts +Checking for slow types in the public API... +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/specs/publish/invalid_path/mod.ts b/tests/specs/publish/invalid_path/mod.ts new file mode 100644 index 000000000..9e217d9b0 --- /dev/null +++ b/tests/specs/publish/invalid_path/mod.ts @@ -0,0 +1,3 @@ +export function foobar(): string { + return "string"; +} diff --git a/tests/specs/publish/invalid_path/path with spaces.txt b/tests/specs/publish/invalid_path/path with spaces.txt new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/specs/publish/invalid_path/path with spaces.txt diff --git a/tests/specs/publish/javascript_decl_file/__test__.jsonc b/tests/specs/publish/javascript_decl_file/__test__.jsonc new file mode 100644 index 000000000..0b6b0888e --- /dev/null +++ b/tests/specs/publish/javascript_decl_file/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "javascript_decl_file.out", + "exitCode": 0 +} diff --git a/tests/specs/publish/javascript_decl_file/deno.json b/tests/specs/publish/javascript_decl_file/deno.json new file mode 100644 index 000000000..e5dbfa8d3 --- /dev/null +++ b/tests/specs/publish/javascript_decl_file/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.js" + } +} diff --git a/tests/specs/publish/javascript_decl_file/javascript_decl_file.out b/tests/specs/publish/javascript_decl_file/javascript_decl_file.out new file mode 100644 index 000000000..48128e82f --- /dev/null +++ b/tests/specs/publish/javascript_decl_file/javascript_decl_file.out @@ -0,0 +1,5 @@ +Check file:///[WILDCARD]/javascript_decl_file/mod.js +Checking for slow types in the public API... +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/javascript_decl_file/mod.d.ts b/tests/specs/publish/javascript_decl_file/mod.d.ts new file mode 100644 index 000000000..b2f6c69a8 --- /dev/null +++ b/tests/specs/publish/javascript_decl_file/mod.d.ts @@ -0,0 +1 @@ +export function getRandom(): number; diff --git a/tests/specs/publish/javascript_decl_file/mod.js b/tests/specs/publish/javascript_decl_file/mod.js new file mode 100644 index 000000000..2395e622b --- /dev/null +++ b/tests/specs/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/specs/publish/javascript_missing_decl_file/__test__.jsonc b/tests/specs/publish/javascript_missing_decl_file/__test__.jsonc new file mode 100644 index 000000000..1e760cf22 --- /dev/null +++ b/tests/specs/publish/javascript_missing_decl_file/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "javascript_missing_decl_file.out", + "exitCode": 0 +} diff --git a/tests/specs/publish/javascript_missing_decl_file/deno.json b/tests/specs/publish/javascript_missing_decl_file/deno.json new file mode 100644 index 000000000..e12927c26 --- /dev/null +++ b/tests/specs/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/specs/publish/javascript_missing_decl_file/javascript_missing_decl_file.out b/tests/specs/publish/javascript_missing_decl_file/javascript_missing_decl_file.out new file mode 100644 index 000000000..08e92e320 --- /dev/null +++ b/tests/specs/publish/javascript_missing_decl_file/javascript_missing_decl_file.out @@ -0,0 +1,20 @@ +Checking for slow types in the public API... +warning[unsupported-javascript-entrypoint]: used a JavaScript module without type declarations as an entrypoint + --> [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/slow-type-unsupported-javascript-entrypoint + +warning[unsupported-javascript-entrypoint]: used a JavaScript module without type declarations as an entrypoint + --> [WILDCARD]other.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/slow-type-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/specs/publish/javascript_missing_decl_file/mod.js b/tests/specs/publish/javascript_missing_decl_file/mod.js new file mode 100644 index 000000000..4a62fa5b4 --- /dev/null +++ b/tests/specs/publish/javascript_missing_decl_file/mod.js @@ -0,0 +1,3 @@ +export function getRandom() { + return Math.random(); +} diff --git a/tests/specs/publish/javascript_missing_decl_file/other.js b/tests/specs/publish/javascript_missing_decl_file/other.js new file mode 100644 index 000000000..89ffb80ba --- /dev/null +++ b/tests/specs/publish/javascript_missing_decl_file/other.js @@ -0,0 +1,3 @@ +export function other() { + return Math.random(); +} diff --git a/tests/specs/publish/jsr_jsonc/__test__.jsonc b/tests/specs/publish/jsr_jsonc/__test__.jsonc new file mode 100644 index 000000000..774d5a534 --- /dev/null +++ b/tests/specs/publish/jsr_jsonc/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "mod.out" +} diff --git a/tests/specs/publish/jsr_jsonc/jsr.jsonc b/tests/specs/publish/jsr_jsonc/jsr.jsonc new file mode 100644 index 000000000..4c9dfb08c --- /dev/null +++ b/tests/specs/publish/jsr_jsonc/jsr.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/specs/publish/jsr_jsonc/mod.out b/tests/specs/publish/jsr_jsonc/mod.out new file mode 100644 index 000000000..38b61d568 --- /dev/null +++ b/tests/specs/publish/jsr_jsonc/mod.out @@ -0,0 +1,6 @@ +Check file:///[WILDCARD]/publish/jsr_jsonc/mod.ts +Checking for slow types in the public API... +Check file:///[WILDCARD]/publish/jsr_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/specs/publish/jsr_jsonc/mod.ts b/tests/specs/publish/jsr_jsonc/mod.ts new file mode 100644 index 000000000..6e8a61bae --- /dev/null +++ b/tests/specs/publish/jsr_jsonc/mod.ts @@ -0,0 +1,7 @@ +import http from "@std/http"; + +export function foobar(): { fileServer(): void } { + return { + fileServer: http.fileServer, + }; +} diff --git a/tests/specs/publish/jsr_jsonc/std_http.ts b/tests/specs/publish/jsr_jsonc/std_http.ts new file mode 100644 index 000000000..9d57b36f3 --- /dev/null +++ b/tests/specs/publish/jsr_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/specs/publish/missing_deno_json/__test__.jsonc b/tests/specs/publish/missing_deno_json/__test__.jsonc new file mode 100644 index 000000000..614caecd6 --- /dev/null +++ b/tests/specs/publish/missing_deno_json/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "missing_deno_json.out", + "exitCode": 1 +} diff --git a/tests/specs/publish/missing_deno_json/main.ts b/tests/specs/publish/missing_deno_json/main.ts new file mode 100644 index 000000000..8d9b8a22a --- /dev/null +++ b/tests/specs/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/specs/publish/missing_deno_json/missing_deno_json.out b/tests/specs/publish/missing_deno_json/missing_deno_json.out new file mode 100644 index 000000000..2c074bf83 --- /dev/null +++ b/tests/specs/publish/missing_deno_json/missing_deno_json.out @@ -0,0 +1 @@ +error: Couldn't find a deno.json, deno.jsonc, jsr.json or jsr.jsonc configuration file in [WILDCARD]
\ No newline at end of file diff --git a/tests/specs/publish/no_check/__test__.jsonc b/tests/specs/publish/no_check/__test__.jsonc new file mode 100644 index 000000000..e89cd7a57 --- /dev/null +++ b/tests/specs/publish/no_check/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf' --no-check", + "output": "successful_no_check.out" +} diff --git a/tests/specs/publish/no_check/deno.json b/tests/specs/publish/no_check/deno.json new file mode 100644 index 000000000..fefab899b --- /dev/null +++ b/tests/specs/publish/no_check/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/specs/publish/no_check/mod.ts b/tests/specs/publish/no_check/mod.ts new file mode 100644 index 000000000..6e8a61bae --- /dev/null +++ b/tests/specs/publish/no_check/mod.ts @@ -0,0 +1,7 @@ +import http from "@std/http"; + +export function foobar(): { fileServer(): void } { + return { + fileServer: http.fileServer, + }; +} diff --git a/tests/specs/publish/no_check/std_http.ts b/tests/specs/publish/no_check/std_http.ts new file mode 100644 index 000000000..9d57b36f3 --- /dev/null +++ b/tests/specs/publish/no_check/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/specs/publish/no_check/successful_no_check.out b/tests/specs/publish/no_check/successful_no_check.out new file mode 100644 index 000000000..01c53a9ba --- /dev/null +++ b/tests/specs/publish/no_check/successful_no_check.out @@ -0,0 +1,4 @@ +Checking for slow types in the public API... +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/no_token/__test__.jsonc b/tests/specs/publish/no_token/__test__.jsonc new file mode 100644 index 000000000..f8a7fa942 --- /dev/null +++ b/tests/specs/publish/no_token/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish", + "output": "no_token.out", + "exitCode": 1 +} diff --git a/tests/specs/publish/no_token/main.ts b/tests/specs/publish/no_token/main.ts new file mode 100644 index 000000000..8d9b8a22a --- /dev/null +++ b/tests/specs/publish/no_token/main.ts @@ -0,0 +1,3 @@ +export function add(a: number, b: number): number { + return a + b; +} diff --git a/tests/specs/publish/no_token/no_token.out b/tests/specs/publish/no_token/no_token.out new file mode 100644 index 000000000..41415094c --- /dev/null +++ b/tests/specs/publish/no_token/no_token.out @@ -0,0 +1 @@ +error: No means to authenticate. Pass a token to `--token`[WILDCARD] diff --git a/tests/specs/publish/node_specifier/__test__.jsonc b/tests/specs/publish/node_specifier/__test__.jsonc new file mode 100644 index 000000000..f845f2479 --- /dev/null +++ b/tests/specs/publish/node_specifier/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "node_specifier.out" +} diff --git a/tests/specs/publish/node_specifier/deno.json b/tests/specs/publish/node_specifier/deno.json new file mode 100644 index 000000000..213a7cec6 --- /dev/null +++ b/tests/specs/publish/node_specifier/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/specs/publish/node_specifier/mod.ts b/tests/specs/publish/node_specifier/mod.ts new file mode 100644 index 000000000..9d8263709 --- /dev/null +++ b/tests/specs/publish/node_specifier/mod.ts @@ -0,0 +1,5 @@ +import "node:http"; + +export function foobar(): string { + return "string"; +} diff --git a/tests/specs/publish/node_specifier/node_specifier.out b/tests/specs/publish/node_specifier/node_specifier.out new file mode 100644 index 000000000..d3e4a367b --- /dev/null +++ b/tests/specs/publish/node_specifier/node_specifier.out @@ -0,0 +1,8 @@ +Download http://localhost:4545/npm/registry/@types/node +Download http://localhost:4545/npm/registry/@types/node/node-[WILDCARD].tgz +Check file:///[WILDCARD]/mod.ts +Checking for slow types in the public API... +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/specs/publish/package_json/__test__.jsonc b/tests/specs/publish/package_json/__test__.jsonc new file mode 100644 index 000000000..c4e954a6e --- /dev/null +++ b/tests/specs/publish/package_json/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "package_json.out" +} diff --git a/tests/specs/publish/package_json/deno.json b/tests/specs/publish/package_json/deno.json new file mode 100644 index 000000000..6e2826ef5 --- /dev/null +++ b/tests/specs/publish/package_json/deno.json @@ -0,0 +1,8 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + }, + "nodeModulesDir": false +} diff --git a/tests/specs/publish/package_json/mod.ts b/tests/specs/publish/package_json/mod.ts new file mode 100644 index 000000000..ae98962fa --- /dev/null +++ b/tests/specs/publish/package_json/mod.ts @@ -0,0 +1,9 @@ +import pc from "picocolors"; + +export function add(a: number, b: number): number { + return a + b; +} + +export function getValue(): string { + return pc.green("hey"); +} diff --git a/tests/specs/publish/package_json/package.json b/tests/specs/publish/package_json/package.json new file mode 100644 index 000000000..c1b171f4c --- /dev/null +++ b/tests/specs/publish/package_json/package.json @@ -0,0 +1,7 @@ +{ + "name": "@deno/foo", + "version": "0.0.1", + "dependencies": { + "picocolors": "*" + } +} diff --git a/tests/specs/publish/package_json/package_json.out b/tests/specs/publish/package_json/package_json.out new file mode 100644 index 000000000..7b54ce8da --- /dev/null +++ b/tests/specs/publish/package_json/package_json.out @@ -0,0 +1,8 @@ +Download http://localhost:4545/npm/registry/picocolors +Download http://localhost:4545/npm/registry/picocolors/picocolors-1.0.0.tgz +Check file:///[WILDCARD]/publish/package_json/mod.ts +Checking for slow types in the public API... +Check file:///[WILDCARD]/publish/package_json/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/sloppy_imports/__test__.jsonc b/tests/specs/publish/sloppy_imports/__test__.jsonc new file mode 100644 index 000000000..bfb3d38dd --- /dev/null +++ b/tests/specs/publish/sloppy_imports/__test__.jsonc @@ -0,0 +1,21 @@ +{ + "envs": { + "DISABLE_JSR_PROVENANCE": "true", + "DENO_TESTING_DISABLE_GIT_CHECK": "1" + }, + "tempDir": true, + "steps": [{ + "args": "publish --token 'sadfasdf' --dry-run --unstable-sloppy-imports", + "output": "sloppy_imports.out" + }, { + "args": "publish --token 'sadfasdf' --dry-run", + "output": "sloppy_imports_not_enabled.out", + "exitCode": 1 + }, { + "args": "publish --token 'sadfasdf' --dry-run --unstable-sloppy-imports", + "output": "sloppy_imports_no_warnings.out", + "envs": { + "DENO_DISABLE_PEDANTIC_NODE_WARNINGS": "1" + } + }] +} diff --git a/tests/specs/publish/sloppy_imports/b/index.ts b/tests/specs/publish/sloppy_imports/b/index.ts new file mode 100644 index 000000000..1392bf6ba --- /dev/null +++ b/tests/specs/publish/sloppy_imports/b/index.ts @@ -0,0 +1 @@ +export const PI = Math.PI; diff --git a/tests/specs/publish/sloppy_imports/deno.json b/tests/specs/publish/sloppy_imports/deno.json new file mode 100644 index 000000000..213a7cec6 --- /dev/null +++ b/tests/specs/publish/sloppy_imports/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/specs/publish/sloppy_imports/mod.ts b/tests/specs/publish/sloppy_imports/mod.ts new file mode 100644 index 000000000..f5084bb3b --- /dev/null +++ b/tests/specs/publish/sloppy_imports/mod.ts @@ -0,0 +1 @@ +export { PI } from "./b"; diff --git a/tests/specs/publish/sloppy_imports/sloppy_imports.out b/tests/specs/publish/sloppy_imports/sloppy_imports.out new file mode 100644 index 000000000..bfa258b93 --- /dev/null +++ b/tests/specs/publish/sloppy_imports/sloppy_imports.out @@ -0,0 +1,10 @@ +Warning Sloppy module resolution (hint: specify path to index.ts file in directory instead) + at file:///[WILDCARD]/mod.ts:1:20 +Check file:///[WILDCARD]/mod.ts +Checking for slow types in the public API... +Check file:///[WILDCARD]/mod.ts +Simulating publish of @foo/bar@1.0.0 with files: + file:///[WILDCARD]/b/index.ts (27B) + file:///[WILDCARD]/deno.json (87B) + file:///[WILDCARD]/mod.ts (35B) +Warning Aborting due to --dry-run diff --git a/tests/specs/publish/sloppy_imports/sloppy_imports_no_warnings.out b/tests/specs/publish/sloppy_imports/sloppy_imports_no_warnings.out new file mode 100644 index 000000000..72ff281a3 --- /dev/null +++ b/tests/specs/publish/sloppy_imports/sloppy_imports_no_warnings.out @@ -0,0 +1,6 @@ +Checking for slow types in the public API... +Simulating publish of @foo/bar@1.0.0 with files: + file:///[WILDCARD]/b/index.ts (27B) + file:///[WILDCARD]/deno.json (87B) + file:///[WILDCARD]/mod.ts (35B) +Warning Aborting due to --dry-run diff --git a/tests/specs/publish/sloppy_imports/sloppy_imports_not_enabled.out b/tests/specs/publish/sloppy_imports/sloppy_imports_not_enabled.out new file mode 100644 index 000000000..4eacbea65 --- /dev/null +++ b/tests/specs/publish/sloppy_imports/sloppy_imports_not_enabled.out @@ -0,0 +1,2 @@ +error: [WILDCARD] Maybe specify path to 'index.ts' file in directory instead or run with --unstable-sloppy-imports + at file:///[WILDCARD]/mod.ts:1:20 diff --git a/tests/specs/publish/successful/__test__.jsonc b/tests/specs/publish/successful/__test__.jsonc new file mode 100644 index 000000000..fe5287e71 --- /dev/null +++ b/tests/specs/publish/successful/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "successful.out" +} diff --git a/tests/specs/publish/successful/deno.json b/tests/specs/publish/successful/deno.json new file mode 100644 index 000000000..fefab899b --- /dev/null +++ b/tests/specs/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/specs/publish/successful/mod.ts b/tests/specs/publish/successful/mod.ts new file mode 100644 index 000000000..6e8a61bae --- /dev/null +++ b/tests/specs/publish/successful/mod.ts @@ -0,0 +1,7 @@ +import http from "@std/http"; + +export function foobar(): { fileServer(): void } { + return { + fileServer: http.fileServer, + }; +} diff --git a/tests/specs/publish/successful/std_http.ts b/tests/specs/publish/successful/std_http.ts new file mode 100644 index 000000000..9d57b36f3 --- /dev/null +++ b/tests/specs/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/specs/publish/successful/successful.out b/tests/specs/publish/successful/successful.out new file mode 100644 index 000000000..a3da4290d --- /dev/null +++ b/tests/specs/publish/successful/successful.out @@ -0,0 +1,6 @@ +Check file:///[WILDCARD]/publish/successful/mod.ts +Checking for slow types in the public API... +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/specs/publish/symlink/__test__.jsonc b/tests/specs/publish/symlink/__test__.jsonc new file mode 100644 index 000000000..32da3baff --- /dev/null +++ b/tests/specs/publish/symlink/__test__.jsonc @@ -0,0 +1,15 @@ +{ + "tempDir": true, + "envs": { + "DISABLE_JSR_PROVENANCE": "true", + "DENO_TESTING_DISABLE_GIT_CHECK": "1" + }, + "steps": [{ + "args": ["eval", "Deno.symlinkSync('./mod.ts', './symlink');"], + "output": "[WILDCARD]" + }, { + "args": "publish --token 'sadfasdf' --dry-run", + "output": "symlink.out", + "exitCode": 0 + }] +} diff --git a/tests/specs/publish/symlink/deno.json b/tests/specs/publish/symlink/deno.json new file mode 100644 index 000000000..213a7cec6 --- /dev/null +++ b/tests/specs/publish/symlink/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/specs/publish/symlink/mod.ts b/tests/specs/publish/symlink/mod.ts new file mode 100644 index 000000000..9e217d9b0 --- /dev/null +++ b/tests/specs/publish/symlink/mod.ts @@ -0,0 +1,3 @@ +export function foobar(): string { + return "string"; +} diff --git a/tests/specs/publish/symlink/symlink.out b/tests/specs/publish/symlink/symlink.out new file mode 100644 index 000000000..9f89f5b7c --- /dev/null +++ b/tests/specs/publish/symlink/symlink.out @@ -0,0 +1,15 @@ +Check [WILDCARD]mod.ts +Checking for slow types in the public API... +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 + +Simulating publish of @foo/bar@1.0.0 with files: + [WILDCARD]deno.json (87B) + [WILDCARD]mod.ts (56B) +Warning Aborting due to --dry-run diff --git a/tests/specs/publish/unanalyzable_dynamic_import/__test__.jsonc b/tests/specs/publish/unanalyzable_dynamic_import/__test__.jsonc new file mode 100644 index 000000000..45073b099 --- /dev/null +++ b/tests/specs/publish/unanalyzable_dynamic_import/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "unanalyzable_dynamic_import.out", + "exitCode": 0 +} diff --git a/tests/specs/publish/unanalyzable_dynamic_import/deno.json b/tests/specs/publish/unanalyzable_dynamic_import/deno.json new file mode 100644 index 000000000..213a7cec6 --- /dev/null +++ b/tests/specs/publish/unanalyzable_dynamic_import/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/specs/publish/unanalyzable_dynamic_import/mod.ts b/tests/specs/publish/unanalyzable_dynamic_import/mod.ts new file mode 100644 index 000000000..291311385 --- /dev/null +++ b/tests/specs/publish/unanalyzable_dynamic_import/mod.ts @@ -0,0 +1,2 @@ +const asd = "asd"; +await import("asd " + asd); diff --git a/tests/specs/publish/unanalyzable_dynamic_import/unanalyzable_dynamic_import.out b/tests/specs/publish/unanalyzable_dynamic_import/unanalyzable_dynamic_import.out new file mode 100644 index 000000000..7f3ca5555 --- /dev/null +++ b/tests/specs/publish/unanalyzable_dynamic_import/unanalyzable_dynamic_import.out @@ -0,0 +1,16 @@ +Check file://[WILDCARD]/mod.ts +Checking for slow types in the public API... +Check file://[WILDCARD]/mod.ts +warning[unanalyzable-dynamic-import]: unable to analyze dynamic import + --> [WILDCARD]mod.ts:2:14 + | +2 | await import("asd " + asd); + | ^^^^^^^^^^^^ the unanalyzable dynamic import + + info: after publishing this package, imports from the local import map / package.json 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 / package.json + +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/unsupported_jsx_tsx/__test__.jsonc b/tests/specs/publish/unsupported_jsx_tsx/__test__.jsonc new file mode 100644 index 000000000..774d5a534 --- /dev/null +++ b/tests/specs/publish/unsupported_jsx_tsx/__test__.jsonc @@ -0,0 +1,4 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "mod.out" +} diff --git a/tests/specs/publish/unsupported_jsx_tsx/foo.jsx b/tests/specs/publish/unsupported_jsx_tsx/foo.jsx new file mode 100644 index 000000000..021c2d49e --- /dev/null +++ b/tests/specs/publish/unsupported_jsx_tsx/foo.jsx @@ -0,0 +1,5 @@ +import { renderToString } from "npm:preact-render-to-string"; + +export default function render() { + return renderToString(<div>foo.tsx</div>); +} diff --git a/tests/specs/publish/unsupported_jsx_tsx/foo.tsx b/tests/specs/publish/unsupported_jsx_tsx/foo.tsx new file mode 100644 index 000000000..021c2d49e --- /dev/null +++ b/tests/specs/publish/unsupported_jsx_tsx/foo.tsx @@ -0,0 +1,5 @@ +import { renderToString } from "npm:preact-render-to-string"; + +export default function render() { + return renderToString(<div>foo.tsx</div>); +} diff --git a/tests/specs/publish/unsupported_jsx_tsx/jsr.jsonc b/tests/specs/publish/unsupported_jsx_tsx/jsr.jsonc new file mode 100644 index 000000000..7aea08842 --- /dev/null +++ b/tests/specs/publish/unsupported_jsx_tsx/jsr.jsonc @@ -0,0 +1,11 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + }, + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "npm:preact" + } +} diff --git a/tests/specs/publish/unsupported_jsx_tsx/mod.out b/tests/specs/publish/unsupported_jsx_tsx/mod.out new file mode 100644 index 000000000..5f085fb33 --- /dev/null +++ b/tests/specs/publish/unsupported_jsx_tsx/mod.out @@ -0,0 +1,17 @@ +[WILDCARD] +Check file:///[WILDCARD]/publish/unsupported_jsx_tsx/mod.ts +Checking for slow types in the public API... +Check file:///[WILDCARD]/publish/unsupported_jsx_tsx/mod.ts +warning[unsupported-jsx-tsx]: JSX and TSX files are currently not supported + --> [WILDCARD]foo.jsx + + info: follow https://github.com/jsr-io/jsr/issues/24 for updates + +warning[unsupported-jsx-tsx]: JSX and TSX files are currently not supported + --> [WILDCARD]foo.tsx + + info: follow https://github.com/jsr-io/jsr/issues/24 for updates + +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/unsupported_jsx_tsx/mod.ts b/tests/specs/publish/unsupported_jsx_tsx/mod.ts new file mode 100644 index 000000000..4631a829d --- /dev/null +++ b/tests/specs/publish/unsupported_jsx_tsx/mod.ts @@ -0,0 +1,7 @@ +import fooTsx from "./foo.tsx"; +import fooJsx from "./foo.jsx"; + +export function renderTsxJsx() { + console.log(fooTsx()); + console.log(fooJsx()); +} diff --git a/tests/specs/publish/workspace/__test__.jsonc b/tests/specs/publish/workspace/__test__.jsonc new file mode 100644 index 000000000..7b1c04d56 --- /dev/null +++ b/tests/specs/publish/workspace/__test__.jsonc @@ -0,0 +1,10 @@ +{ + "steps": [{ + "args": "publish --token 'sadfasdf'", + "output": "workspace.out" + }, { + "cwd": "./bar", + "args": "publish --token 'sadfasdf'", + "output": "workspace_individual.out" + }] +} diff --git a/tests/specs/publish/workspace/bar/deno.json b/tests/specs/publish/workspace/bar/deno.json new file mode 100644 index 000000000..213a7cec6 --- /dev/null +++ b/tests/specs/publish/workspace/bar/deno.json @@ -0,0 +1,7 @@ +{ + "name": "@foo/bar", + "version": "1.0.0", + "exports": { + ".": "./mod.ts" + } +} diff --git a/tests/specs/publish/workspace/bar/mod.ts b/tests/specs/publish/workspace/bar/mod.ts new file mode 100644 index 000000000..8d9b8a22a --- /dev/null +++ b/tests/specs/publish/workspace/bar/mod.ts @@ -0,0 +1,3 @@ +export function add(a: number, b: number): number { + return a + b; +} diff --git a/tests/specs/publish/workspace/deno.json b/tests/specs/publish/workspace/deno.json new file mode 100644 index 000000000..57602aab5 --- /dev/null +++ b/tests/specs/publish/workspace/deno.json @@ -0,0 +1,6 @@ +{ + "workspaces": [ + "foo", + "bar" + ] +} diff --git a/tests/specs/publish/workspace/foo/deno.json b/tests/specs/publish/workspace/foo/deno.json new file mode 100644 index 000000000..79563d36c --- /dev/null +++ b/tests/specs/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/specs/publish/workspace/foo/mod.ts b/tests/specs/publish/workspace/foo/mod.ts new file mode 100644 index 000000000..adf584463 --- /dev/null +++ b/tests/specs/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/specs/publish/workspace/workspace.out b/tests/specs/publish/workspace/workspace.out new file mode 100644 index 000000000..8c57bc2dd --- /dev/null +++ b/tests/specs/publish/workspace/workspace.out @@ -0,0 +1,12 @@ +Publishing a workspace... +Check file:///[WILDCARD]/foo/mod.ts +Check file:///[WILDCARD]/bar/mod.ts +Checking for slow types in the public API... +Check file:///[WILDCARD]/foo/mod.ts +Check file:///[WILDCARD]/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/specs/publish/workspace/workspace_individual.out b/tests/specs/publish/workspace/workspace_individual.out new file mode 100644 index 000000000..edb6b53aa --- /dev/null +++ b/tests/specs/publish/workspace/workspace_individual.out @@ -0,0 +1,6 @@ +Check file:///[WILDCARD]/bar/mod.ts +Checking for slow types in the public API... +Check file:///[WILDCARD]/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 |
