diff options
| author | David Sherret <dsherret@users.noreply.github.com> | 2024-04-29 10:08:27 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-29 10:08:27 -0400 |
| commit | da52058a945999d486b07700d2834f027a65947c (patch) | |
| tree | b6031c274cbc36dcefc6d681473e366cdb208c89 /tests/specs/publish/invalid_import | |
| parent | b02ffec37c73be8a73b95b33b32efa693e84e01b (diff) | |
chore: migrate bench, publish, and more itests to spec tests (#23584)
Diffstat (limited to 'tests/specs/publish/invalid_import')
| -rw-r--r-- | tests/specs/publish/invalid_import/__test__.jsonc | 5 | ||||
| -rw-r--r-- | tests/specs/publish/invalid_import/deno.json | 10 | ||||
| -rw-r--r-- | tests/specs/publish/invalid_import/invalid_import.out | 32 | ||||
| -rw-r--r-- | tests/specs/publish/invalid_import/mod.ts | 9 |
4 files changed, 56 insertions, 0 deletions
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"; +} |
