diff options
Diffstat (limited to 'tests/specs')
14 files changed, 106 insertions, 5 deletions
diff --git a/tests/specs/jsr/no_unused_params/main.ts b/tests/specs/jsr/no_unused_params/main.ts index e8b12ca89..54665c107 100644 --- a/tests/specs/jsr/no_unused_params/main.ts +++ b/tests/specs/jsr/no_unused_params/main.ts @@ -1,4 +1,4 @@ -import * as inner from "jsr:@denotest/add"; +import * as inner from "jsr:@denotest/add@1"; export function add(a: number, b: number): number { return inner.add(a, b); diff --git a/tests/specs/publish/missing_constraint/__test__.jsonc b/tests/specs/publish/missing_constraint/__test__.jsonc new file mode 100644 index 000000000..06a91f5b6 --- /dev/null +++ b/tests/specs/publish/missing_constraint/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --dry-run", + "output": "publish.out", + "exitCode": 1 +} diff --git a/tests/specs/publish/missing_constraint/deno.json b/tests/specs/publish/missing_constraint/deno.json new file mode 100644 index 000000000..89f6db90c --- /dev/null +++ b/tests/specs/publish/missing_constraint/deno.json @@ -0,0 +1,9 @@ +{ + "name": "@scope/pkg", + "version": "1.0.0", + "exports": "./mod.ts", + "imports": { + "basic": "npm:@denotest/esm-basic", + "add": "jsr:@denotest/add" + } +} diff --git a/tests/specs/publish/missing_constraint/mod.ts b/tests/specs/publish/missing_constraint/mod.ts new file mode 100644 index 000000000..59e40d241 --- /dev/null +++ b/tests/specs/publish/missing_constraint/mod.ts @@ -0,0 +1,7 @@ +import { add } from "add"; +import * as basic from "basic"; +import * as deps from "jsr:@denotest/deps"; + +console.log(add(1, 2)); +console.log(deps); +console.log(basic); diff --git a/tests/specs/publish/missing_constraint/publish.out b/tests/specs/publish/missing_constraint/publish.out new file mode 100644 index 000000000..846612979 --- /dev/null +++ b/tests/specs/publish/missing_constraint/publish.out @@ -0,0 +1,37 @@ +[WILDCARD] +Checking for slow types in the public API... +Check file:///[WILDLINE]/mod.ts +error[missing-constraint]: specifier 'jsr:@denotest/add' is missing a version constraint + --> [WILDLINE]mod.ts:[WILDLINE] + | +1 | import { add } from "add"; + | ^^^^^ the specifier + = hint: specify a version constraint for the specifier in the import map + + info: the specifier resolved to version 1.0.0 today, but will resolve to a different + info: major version if one is published in the future and potentially break + docs: https://jsr.io/go/missing-constraint + +error[missing-constraint]: specifier 'npm:@denotest/esm-basic' is missing a version constraint + --> [WILDLINE]mod.ts:[WILDLINE] + | +2 | import * as basic from "basic"; + | ^^^^^^^ the specifier + = hint: specify a version constraint for the specifier in the import map + + info: the specifier resolved to version 1.0.0 today, but will resolve to a different + info: major version if one is published in the future and potentially break + docs: https://jsr.io/go/missing-constraint + +error[missing-constraint]: specifier 'jsr:@denotest/deps' is missing a version constraint + --> [WILDLINE]mod.ts:[WILDLINE] + | +3 | import * as deps from "jsr:@denotest/deps"; + | ^^^^^^^^^^^^^^^^^^^^ the specifier + = hint: specify a version constraint for the specifier + + info: the specifier resolved to version 1.0.0 today, but will resolve to a different + info: major version if one is published in the future and potentially break + docs: https://jsr.io/go/missing-constraint + +error: Found 3 problems diff --git a/tests/specs/publish/missing_constraint_jsx_import_source/__test__.jsonc b/tests/specs/publish/missing_constraint_jsx_import_source/__test__.jsonc new file mode 100644 index 000000000..1b96278a0 --- /dev/null +++ b/tests/specs/publish/missing_constraint_jsx_import_source/__test__.jsonc @@ -0,0 +1,5 @@ +{ + "args": "publish --token 'sadfasdf'", + "output": "mod.out", + "exitCode": 1 +} diff --git a/tests/specs/publish/missing_constraint_jsx_import_source/foo.tsx b/tests/specs/publish/missing_constraint_jsx_import_source/foo.tsx new file mode 100644 index 000000000..120e8b334 --- /dev/null +++ b/tests/specs/publish/missing_constraint_jsx_import_source/foo.tsx @@ -0,0 +1,5 @@ +import { renderToString } from "npm:preact-render-to-string@6"; + +export default function render() { + return renderToString(<div>foo.tsx</div>); +} diff --git a/tests/specs/publish/missing_constraint_jsx_import_source/jsr.jsonc b/tests/specs/publish/missing_constraint_jsx_import_source/jsr.jsonc new file mode 100644 index 000000000..7aea08842 --- /dev/null +++ b/tests/specs/publish/missing_constraint_jsx_import_source/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/missing_constraint_jsx_import_source/mod.out b/tests/specs/publish/missing_constraint_jsx_import_source/mod.out new file mode 100644 index 000000000..d1da06be8 --- /dev/null +++ b/tests/specs/publish/missing_constraint_jsx_import_source/mod.out @@ -0,0 +1,17 @@ +[WILDCARD] +Checking for slow types in the public API... +Check file:///[WILDCARD]/mod.ts +error[missing-constraint]: specifier 'npm:preact/jsx-runtime' is missing a version constraint + --> [WILDLINE] + = hint: specify a version constraint for the specifier + + info: the specifier resolved to version 10.19.6 today, but will resolve to a different + info: major version if one is published in the future and potentially break + docs: https://jsr.io/go/missing-constraint + +warning[unsupported-jsx-tsx]: JSX and TSX files are currently not supported + --> [WILDLINE]foo.tsx + + info: follow https://github.com/jsr-io/jsr/issues/24 for updates + +error: Found 1 problem diff --git a/tests/specs/publish/missing_constraint_jsx_import_source/mod.ts b/tests/specs/publish/missing_constraint_jsx_import_source/mod.ts new file mode 100644 index 000000000..9935bf5ee --- /dev/null +++ b/tests/specs/publish/missing_constraint_jsx_import_source/mod.ts @@ -0,0 +1,5 @@ +import fooTsx from "./foo.tsx"; + +export function renderTsx() { + console.log(fooTsx()); +} diff --git a/tests/specs/publish/package_json/package.json b/tests/specs/publish/package_json/package.json index c1b171f4c..4239110bd 100644 --- a/tests/specs/publish/package_json/package.json +++ b/tests/specs/publish/package_json/package.json @@ -2,6 +2,6 @@ "name": "@deno/foo", "version": "0.0.1", "dependencies": { - "picocolors": "*" + "picocolors": "1" } } diff --git a/tests/specs/publish/unsupported_jsx_tsx/foo.jsx b/tests/specs/publish/unsupported_jsx_tsx/foo.jsx index 021c2d49e..120e8b334 100644 --- a/tests/specs/publish/unsupported_jsx_tsx/foo.jsx +++ b/tests/specs/publish/unsupported_jsx_tsx/foo.jsx @@ -1,4 +1,4 @@ -import { renderToString } from "npm:preact-render-to-string"; +import { renderToString } from "npm:preact-render-to-string@6"; 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 index 021c2d49e..120e8b334 100644 --- a/tests/specs/publish/unsupported_jsx_tsx/foo.tsx +++ b/tests/specs/publish/unsupported_jsx_tsx/foo.tsx @@ -1,4 +1,4 @@ -import { renderToString } from "npm:preact-render-to-string"; +import { renderToString } from "npm:preact-render-to-string@6"; 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 index 7aea08842..e411bf54b 100644 --- a/tests/specs/publish/unsupported_jsx_tsx/jsr.jsonc +++ b/tests/specs/publish/unsupported_jsx_tsx/jsr.jsonc @@ -6,6 +6,6 @@ }, "compilerOptions": { "jsx": "react-jsx", - "jsxImportSource": "npm:preact" + "jsxImportSource": "npm:preact@10" } } |