From 679a0c428c2aeebdd5c23141d3653b8fbb9c41fc Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Fri, 7 Jul 2023 01:22:22 +0200 Subject: tests: add more jsxImportSource regression tests (#15592) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds some regression tests for using `jsxImportSource` in the config file in combination with an import map. These underlying issues were fixed by #15561. Closes #13389 Closes #14723 --------- Co-authored-by: Aapo Alasuutari Co-authored-by: Bartek IwaƄczuk --- cli/tests/integration/check_tests.rs | 10 ++++++++++ .../testdata/check/jsximportsource_importmap_config/deno.json | 7 +++++++ .../check/jsximportsource_importmap_config/import_map.json | 5 +++++ .../check/jsximportsource_importmap_config/jsx_runtime.ts | 4 ++++ .../check/jsximportsource_importmap_config/main.bundle.js | 9 +++++++++ .../testdata/check/jsximportsource_importmap_config/main.tsx | 1 + 6 files changed, 36 insertions(+) create mode 100644 cli/tests/testdata/check/jsximportsource_importmap_config/deno.json create mode 100644 cli/tests/testdata/check/jsximportsource_importmap_config/import_map.json create mode 100644 cli/tests/testdata/check/jsximportsource_importmap_config/jsx_runtime.ts create mode 100644 cli/tests/testdata/check/jsximportsource_importmap_config/main.bundle.js create mode 100644 cli/tests/testdata/check/jsximportsource_importmap_config/main.tsx (limited to 'cli') diff --git a/cli/tests/integration/check_tests.rs b/cli/tests/integration/check_tests.rs index ab17713f2..0f1c8cb59 100644 --- a/cli/tests/integration/check_tests.rs +++ b/cli/tests/integration/check_tests.rs @@ -48,6 +48,16 @@ itest!(declaration_header_file_with_no_exports { output_str: Some(""), }); +itest!(check_jsximportsource_importmap_config { + args: "check --quiet --config check/jsximportsource_importmap_config/deno.json check/jsximportsource_importmap_config/main.tsx", + output_str: Some(""), +}); + +itest!(bundle_jsximportsource_importmap_config { + args: "bundle --quiet --config check/jsximportsource_importmap_config/deno.json check/jsximportsource_importmap_config/main.tsx", + output: "check/jsximportsource_importmap_config/main.bundle.js", +}); + itest!(check_npm_install_diagnostics { args: "check --quiet check/npm_install_diagnostics/main.ts", output: "check/npm_install_diagnostics/main.out", diff --git a/cli/tests/testdata/check/jsximportsource_importmap_config/deno.json b/cli/tests/testdata/check/jsximportsource_importmap_config/deno.json new file mode 100644 index 000000000..6d837af7c --- /dev/null +++ b/cli/tests/testdata/check/jsximportsource_importmap_config/deno.json @@ -0,0 +1,7 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "jsxImportSource": "jsx" + }, + "importMap": "./import_map.json" +} diff --git a/cli/tests/testdata/check/jsximportsource_importmap_config/import_map.json b/cli/tests/testdata/check/jsximportsource_importmap_config/import_map.json new file mode 100644 index 000000000..e926207af --- /dev/null +++ b/cli/tests/testdata/check/jsximportsource_importmap_config/import_map.json @@ -0,0 +1,5 @@ +{ + "imports": { + "jsx/jsx-runtime": "./jsx_runtime.ts" + } +} diff --git a/cli/tests/testdata/check/jsximportsource_importmap_config/jsx_runtime.ts b/cli/tests/testdata/check/jsximportsource_importmap_config/jsx_runtime.ts new file mode 100644 index 000000000..33a07ca73 --- /dev/null +++ b/cli/tests/testdata/check/jsximportsource_importmap_config/jsx_runtime.ts @@ -0,0 +1,4 @@ +// deno-lint-ignore no-namespace +export namespace JSX { + export type IntrinsicElements = { [key: string]: unknown }; +} diff --git a/cli/tests/testdata/check/jsximportsource_importmap_config/main.bundle.js b/cli/tests/testdata/check/jsximportsource_importmap_config/main.bundle.js new file mode 100644 index 000000000..6f39c876e --- /dev/null +++ b/cli/tests/testdata/check/jsximportsource_importmap_config/main.bundle.js @@ -0,0 +1,9 @@ +// deno-fmt-ignore-file +// deno-lint-ignore-file +// This code was bundled using `deno bundle` and it's not recommended to edit it manually + +const makeParagraph = ()=>jsx("p", { + children: "A paragraph!" + }); +export { makeParagraph as makeParagraph }; + diff --git a/cli/tests/testdata/check/jsximportsource_importmap_config/main.tsx b/cli/tests/testdata/check/jsximportsource_importmap_config/main.tsx new file mode 100644 index 000000000..a1eb24f0b --- /dev/null +++ b/cli/tests/testdata/check/jsximportsource_importmap_config/main.tsx @@ -0,0 +1 @@ +export const makeParagraph = () =>

A paragraph!

; -- cgit v1.2.3