diff options
author | Luca Casonato <hello@lcas.dev> | 2022-08-24 19:36:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-24 19:36:05 +0200 |
commit | 33c4d45328166d103e99a8c243727eead626080c (patch) | |
tree | 70331a9964f8faf780942696c34aab867accf7bf /cli/tests | |
parent | 6bb72a80863ac3913d32ea21aae32dd327ce6b71 (diff) |
fix: resolve `jsxImportSource` relative to module (#15561)
Previously `jsxImportSource` was resolved relative to the config file
during graph building, and relative to the emitted module during
runtime.
This is now fixed so that the JSX import source is resolved relative to
the module both during graph building and at runtime.
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration/run_tests.rs | 12 | ||||
-rw-r--r-- | cli/tests/testdata/jsx/import-map-scoped.json | 8 | ||||
-rw-r--r-- | cli/tests/testdata/jsx_import_source_error.out | 2 | ||||
-rw-r--r-- | cli/tests/testdata/subdir/jsx_import_source_no_pragma.tsx | 7 |
4 files changed, 28 insertions, 1 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index 8998eecc9..20661f27f 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -1337,6 +1337,18 @@ itest!(jsx_import_source_import_map_dev { http_server: true, }); +itest!(jsx_import_source_import_map_scoped { + args: "run --reload --import-map jsx/import-map-scoped.json --config jsx/deno-jsx-import-map.jsonc subdir/jsx_import_source_no_pragma.tsx", + output: "jsx_import_source_import_map.out", + http_server: true, +}); + +itest!(jsx_import_source_import_map_scoped_dev { + args: "run --reload --import-map jsx/import-map-scoped.json --config jsx/deno-jsxdev-import-map.jsonc subdir/jsx_import_source_no_pragma.tsx", + output: "jsx_import_source_import_map_dev.out", + http_server: true, +}); + itest!(jsx_import_source_pragma_no_check { args: "run --reload --no-check jsx_import_source_pragma.tsx", output: "jsx_import_source.out", diff --git a/cli/tests/testdata/jsx/import-map-scoped.json b/cli/tests/testdata/jsx/import-map-scoped.json new file mode 100644 index 000000000..9b2005128 --- /dev/null +++ b/cli/tests/testdata/jsx/import-map-scoped.json @@ -0,0 +1,8 @@ +{ + "scopes": { + "../subdir/": { + "jsx/jsx-runtime": "http://localhost:4545/jsx/jsx-runtime/index.ts", + "jsx/jsx-dev-runtime": "http://localhost:4545/jsx/jsx-dev-runtime/index.ts" + } + } +} diff --git a/cli/tests/testdata/jsx_import_source_error.out b/cli/tests/testdata/jsx_import_source_error.out index 957fa4a97..634a5b09b 100644 --- a/cli/tests/testdata/jsx_import_source_error.out +++ b/cli/tests/testdata/jsx_import_source_error.out @@ -1,2 +1,2 @@ error: Module not found "file:///[WILDCARD]/nonexistent/jsx-runtime". - at file:///[WILDCARD]/deno-jsx-error.jsonc:1:1 + at file:///[WILDCARD]/jsx_import_source_no_pragma.tsx:1:1 diff --git a/cli/tests/testdata/subdir/jsx_import_source_no_pragma.tsx b/cli/tests/testdata/subdir/jsx_import_source_no_pragma.tsx new file mode 100644 index 000000000..2c756054f --- /dev/null +++ b/cli/tests/testdata/subdir/jsx_import_source_no_pragma.tsx @@ -0,0 +1,7 @@ +function A() { + return "hello"; +} + +export function B() { + return <A></A>; +} |