summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/run_tests.rs6
-rw-r--r--cli/tests/testdata/jsx/deno-jsx-precompile.jsonc6
-rw-r--r--cli/tests/testdata/jsx/import-map.json3
-rw-r--r--cli/tests/testdata/jsx/jsx-precompile/index.ts23
-rw-r--r--cli/tests/testdata/run/jsx_precompile/no_pragma.out3
-rw-r--r--cli/tests/testdata/run/jsx_precompile/no_pragma.tsx3
6 files changed, 43 insertions, 1 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs
index 64df31818..61749f751 100644
--- a/cli/tests/integration/run_tests.rs
+++ b/cli/tests/integration/run_tests.rs
@@ -1779,6 +1779,12 @@ itest!(jsx_import_source_pragma_import_map_dev {
http_server: true,
});
+itest!(jsx_import_source_precompile_import_map {
+ args: "run --reload --check --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-precompile.jsonc run/jsx_precompile/no_pragma.tsx",
+ output: "run/jsx_precompile/no_pragma.out",
+ http_server: true,
+});
+
itest!(jsx_import_source_import_map {
args: "run --reload --import-map jsx/import-map.json --no-lock --config jsx/deno-jsx-import-map.jsonc run/jsx_import_source_no_pragma.tsx",
output: "run/jsx_import_source_import_map.out",
diff --git a/cli/tests/testdata/jsx/deno-jsx-precompile.jsonc b/cli/tests/testdata/jsx/deno-jsx-precompile.jsonc
new file mode 100644
index 000000000..95ae1b9f3
--- /dev/null
+++ b/cli/tests/testdata/jsx/deno-jsx-precompile.jsonc
@@ -0,0 +1,6 @@
+{
+ "compilerOptions": {
+ "jsx": "precompile",
+ "jsxImportSource": "jsx-precompile"
+ }
+}
diff --git a/cli/tests/testdata/jsx/import-map.json b/cli/tests/testdata/jsx/import-map.json
index baab76f20..1bfa04e2f 100644
--- a/cli/tests/testdata/jsx/import-map.json
+++ b/cli/tests/testdata/jsx/import-map.json
@@ -1,6 +1,7 @@
{
"imports": {
"jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts",
- "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts"
+ "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts",
+ "jsx-precompile/jsx-runtime": "http://localhost:4545/jsx/jsx-precompile/index.ts"
}
}
diff --git a/cli/tests/testdata/jsx/jsx-precompile/index.ts b/cli/tests/testdata/jsx/jsx-precompile/index.ts
new file mode 100644
index 000000000..0d56095e0
--- /dev/null
+++ b/cli/tests/testdata/jsx/jsx-precompile/index.ts
@@ -0,0 +1,23 @@
+// deno-lint-ignore-file no-explicit-any
+export function jsx(
+ _type: any,
+ _props: any,
+ _key: any,
+ _source: any,
+ _self: any,
+) {}
+// deno-lint-ignore-file no-explicit-any
+export const jsxAttr = (name: string, value: any) => `${name}="${value}"`;
+// deno-lint-ignore-file no-explicit-any
+export const jsxTemplate = (_template: string[], ..._exprs: any[]) => "";
+// deno-lint-ignore-file no-explicit-any
+export const jsxEscape = (_value: any) => "";
+console.log("imported", import.meta.url);
+
+declare global {
+ namespace JSX {
+ interface IntrinsicElements {
+ [tagName: string]: Record<string, any>;
+ }
+ }
+}
diff --git a/cli/tests/testdata/run/jsx_precompile/no_pragma.out b/cli/tests/testdata/run/jsx_precompile/no_pragma.out
new file mode 100644
index 000000000..437995923
--- /dev/null
+++ b/cli/tests/testdata/run/jsx_precompile/no_pragma.out
@@ -0,0 +1,3 @@
+Download http://localhost:4545/jsx/jsx-precompile/index.ts
+Check file:///[WILDCARD]/run/jsx_precompile/no_pragma.tsx
+imported http://localhost:4545/jsx/jsx-precompile/index.ts
diff --git a/cli/tests/testdata/run/jsx_precompile/no_pragma.tsx b/cli/tests/testdata/run/jsx_precompile/no_pragma.tsx
new file mode 100644
index 000000000..7ba21d80d
--- /dev/null
+++ b/cli/tests/testdata/run/jsx_precompile/no_pragma.tsx
@@ -0,0 +1,3 @@
+export function A() {
+ return <h1>hello</h1>;
+}