summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/publish_tests.rs10
-rw-r--r--cli/tests/testdata/publish/invalid_import.out32
-rw-r--r--cli/tests/testdata/publish/invalid_import/deno.json10
-rw-r--r--cli/tests/testdata/publish/invalid_import/mod.ts9
-rw-r--r--cli/tests/testdata/publish/symlink.out1
5 files changed, 62 insertions, 0 deletions
diff --git a/cli/tests/integration/publish_tests.rs b/cli/tests/integration/publish_tests.rs
index 0e917eab9..59486602d 100644
--- a/cli/tests/integration/publish_tests.rs
+++ b/cli/tests/integration/publish_tests.rs
@@ -3,6 +3,7 @@
use deno_core::serde_json::json;
use test_util::assert_contains;
use test_util::assert_not_contains;
+use test_util::env_vars_for_npm_tests;
use test_util::TestContextBuilder;
static TEST_REGISTRY_URL: &str = "http://127.0.0.1:4250";
@@ -49,6 +50,15 @@ itest!(symlink {
exit_code: 0,
});
+itest!(invalid_import {
+ args: "publish --token 'sadfasdf' --dry-run",
+ output: "publish/invalid_import.out",
+ cwd: Some("publish/invalid_import"),
+ envs: env_vars_for_npm_tests(),
+ exit_code: 1,
+ http_server: true,
+});
+
itest!(javascript_missing_decl_file {
args: "publish --token 'sadfasdf'",
output: "publish/javascript_missing_decl_file.out",
diff --git a/cli/tests/testdata/publish/invalid_import.out b/cli/tests/testdata/publish/invalid_import.out
new file mode 100644
index 000000000..ca9d20eed
--- /dev/null
+++ b/cli/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/cli/tests/testdata/publish/invalid_import/deno.json b/cli/tests/testdata/publish/invalid_import/deno.json
new file mode 100644
index 000000000..49b666d22
--- /dev/null
+++ b/cli/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/cli/tests/testdata/publish/invalid_import/mod.ts b/cli/tests/testdata/publish/invalid_import/mod.ts
new file mode 100644
index 000000000..bdaf010e2
--- /dev/null
+++ b/cli/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/cli/tests/testdata/publish/symlink.out b/cli/tests/testdata/publish/symlink.out
index 5befec4f9..d226fa18e 100644
--- a/cli/tests/testdata/publish/symlink.out
+++ b/cli/tests/testdata/publish/symlink.out
@@ -7,5 +7,6 @@ warning[unsupported-file-type]: unsupported file type 'symlink'
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