summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/publish_tests.rs16
-rw-r--r--tests/testdata/publish/bare_node_builtins.out11
-rw-r--r--tests/testdata/publish/bare_node_builtins/deno.json7
-rw-r--r--tests/testdata/publish/bare_node_builtins/mod.ts5
-rw-r--r--tests/testdata/publish/sloppy_imports.out12
-rw-r--r--tests/testdata/publish/sloppy_imports/b/index.ts1
-rw-r--r--tests/testdata/publish/sloppy_imports/deno.json7
-rw-r--r--tests/testdata/publish/sloppy_imports/mod.ts1
-rw-r--r--tests/testdata/publish/unanalyzable_dynamic_import.out4
-rw-r--r--tests/testdata/unfurl/b.ts0
-rw-r--r--tests/testdata/unfurl/baz/index.js0
11 files changed, 62 insertions, 2 deletions
diff --git a/tests/integration/publish_tests.rs b/tests/integration/publish_tests.rs
index d2ea27906..ae7a332c4 100644
--- a/tests/integration/publish_tests.rs
+++ b/tests/integration/publish_tests.rs
@@ -224,6 +224,22 @@ itest!(config_flag {
http_server: true,
});
+itest!(bare_node_builtins {
+ args: "publish --token 'sadfasdf' --dry-run --unstable-bare-node-builtins",
+ output: "publish/bare_node_builtins.out",
+ cwd: Some("publish/bare_node_builtins"),
+ envs: env_vars_for_jsr_npm_tests(),
+ http_server: true,
+});
+
+itest!(sloppy_imports {
+ args: "publish --token 'sadfasdf' --dry-run --unstable-sloppy-imports",
+ output: "publish/sloppy_imports.out",
+ cwd: Some("publish/sloppy_imports"),
+ envs: env_vars_for_jsr_tests(),
+ http_server: true,
+});
+
itest!(jsr_jsonc {
args: "publish --token 'sadfasdf'",
cwd: Some("publish/jsr_jsonc"),
diff --git a/tests/testdata/publish/bare_node_builtins.out b/tests/testdata/publish/bare_node_builtins.out
new file mode 100644
index 000000000..99d7e4cf9
--- /dev/null
+++ b/tests/testdata/publish/bare_node_builtins.out
@@ -0,0 +1,11 @@
+Warning: Resolving "url" as "node:url" at file:///[WILDCARD]/publish/bare_node_builtins/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:///[WILDCARD]/publish/bare_node_builtins/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.8.2.tgz
+Check file:///[WILDCARD]/publish/bare_node_builtins/mod.ts
+Checking for slow types in the public API...
+Check file:///[WILDCARD]/publish/bare_node_builtins/mod.ts
+Simulating publish of @foo/bar@1.0.0 with files:
+ file:///[WILDCARD]/publish/bare_node_builtins/deno.json (87B)
+ file:///[WILDCARD]/publish/bare_node_builtins/mod.ts (121B)
+Warning Aborting due to --dry-run
diff --git a/tests/testdata/publish/bare_node_builtins/deno.json b/tests/testdata/publish/bare_node_builtins/deno.json
new file mode 100644
index 000000000..213a7cec6
--- /dev/null
+++ b/tests/testdata/publish/bare_node_builtins/deno.json
@@ -0,0 +1,7 @@
+{
+ "name": "@foo/bar",
+ "version": "1.0.0",
+ "exports": {
+ ".": "./mod.ts"
+ }
+}
diff --git a/tests/testdata/publish/bare_node_builtins/mod.ts b/tests/testdata/publish/bare_node_builtins/mod.ts
new file mode 100644
index 000000000..04374d8b7
--- /dev/null
+++ b/tests/testdata/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/testdata/publish/sloppy_imports.out b/tests/testdata/publish/sloppy_imports.out
new file mode 100644
index 000000000..a3af86575
--- /dev/null
+++ b/tests/testdata/publish/sloppy_imports.out
@@ -0,0 +1,12 @@
+Warning Sloppy module resolution (hint: specify path to index.ts file in directory instead)
+ at file:///[WILDCARD]/publish/sloppy_imports/mod.ts:1:20
+Warning Sloppy module resolution (hint: specify path to index.ts file in directory instead)
+ at file:///[WILDCARD]/publish/sloppy_imports/mod.ts:1:20
+Check file:///[WILDCARD]/publish/sloppy_imports/mod.ts
+Checking for slow types in the public API...
+Check file:///[WILDCARD]/publish/sloppy_imports/mod.ts
+Simulating publish of @foo/bar@1.0.0 with files:
+ file:///[WILDCARD]/publish/sloppy_imports/b/index.ts (27B)
+ file:///[WILDCARD]/publish/sloppy_imports/deno.json (87B)
+ file:///[WILDCARD]/publish/sloppy_imports/mod.ts (35B)
+Warning Aborting due to --dry-run
diff --git a/tests/testdata/publish/sloppy_imports/b/index.ts b/tests/testdata/publish/sloppy_imports/b/index.ts
new file mode 100644
index 000000000..1392bf6ba
--- /dev/null
+++ b/tests/testdata/publish/sloppy_imports/b/index.ts
@@ -0,0 +1 @@
+export const PI = Math.PI;
diff --git a/tests/testdata/publish/sloppy_imports/deno.json b/tests/testdata/publish/sloppy_imports/deno.json
new file mode 100644
index 000000000..213a7cec6
--- /dev/null
+++ b/tests/testdata/publish/sloppy_imports/deno.json
@@ -0,0 +1,7 @@
+{
+ "name": "@foo/bar",
+ "version": "1.0.0",
+ "exports": {
+ ".": "./mod.ts"
+ }
+}
diff --git a/tests/testdata/publish/sloppy_imports/mod.ts b/tests/testdata/publish/sloppy_imports/mod.ts
new file mode 100644
index 000000000..f5084bb3b
--- /dev/null
+++ b/tests/testdata/publish/sloppy_imports/mod.ts
@@ -0,0 +1 @@
+export { PI } from "./b";
diff --git a/tests/testdata/publish/unanalyzable_dynamic_import.out b/tests/testdata/publish/unanalyzable_dynamic_import.out
index da6a6f902..7f3ca5555 100644
--- a/tests/testdata/publish/unanalyzable_dynamic_import.out
+++ b/tests/testdata/publish/unanalyzable_dynamic_import.out
@@ -7,9 +7,9 @@ warning[unanalyzable-dynamic-import]: unable to analyze dynamic import
2 | await import("asd " + asd);
| ^^^^^^^^^^^^ the unanalyzable dynamic import
- info: after publishing this package, imports from the local import map do not work
+ 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
+ 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
diff --git a/tests/testdata/unfurl/b.ts b/tests/testdata/unfurl/b.ts
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testdata/unfurl/b.ts
diff --git a/tests/testdata/unfurl/baz/index.js b/tests/testdata/unfurl/baz/index.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testdata/unfurl/baz/index.js