From 805992b14a65a6dbfb857dea6d9b657477de043d Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Tue, 25 Feb 2020 19:32:43 +1100 Subject: Fix issues with JavaScript importing JavaScript. (#4120) Fixes #3852 Fixes #4117 --- cli/tests/038_checkjs.tsconfig.json | 1 + cli/tests/fix_js_import_js.ts | 3 +++ cli/tests/fix_js_import_js.ts.out | 1 + cli/tests/integration_tests.rs | 5 +++++ cli/tests/subdir/mod6.js | 1 + 5 files changed, 11 insertions(+) create mode 100644 cli/tests/fix_js_import_js.ts create mode 100644 cli/tests/fix_js_import_js.ts.out create mode 100644 cli/tests/subdir/mod6.js (limited to 'cli/tests') diff --git a/cli/tests/038_checkjs.tsconfig.json b/cli/tests/038_checkjs.tsconfig.json index 08ac60b6c..46d96db9e 100644 --- a/cli/tests/038_checkjs.tsconfig.json +++ b/cli/tests/038_checkjs.tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "allowJs": true, "checkJs": true } } diff --git a/cli/tests/fix_js_import_js.ts b/cli/tests/fix_js_import_js.ts new file mode 100644 index 000000000..c9f341748 --- /dev/null +++ b/cli/tests/fix_js_import_js.ts @@ -0,0 +1,3 @@ +import { isMod4 } from "./subdir/mod6.js"; + +console.log(isMod4); diff --git a/cli/tests/fix_js_import_js.ts.out b/cli/tests/fix_js_import_js.ts.out new file mode 100644 index 000000000..27ba77dda --- /dev/null +++ b/cli/tests/fix_js_import_js.ts.out @@ -0,0 +1 @@ +true diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 1767be7c2..ccc571331 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1160,6 +1160,11 @@ itest!(cafile_info { http_server: true, }); +itest!(fix_js_import_js { + args: "run --reload fix_js_import_js.ts", + output: "fix_js_import_js.ts.out", +}); + itest!(fix_js_imports { args: "run --reload fix_js_imports.ts", output: "fix_js_imports.ts.out", diff --git a/cli/tests/subdir/mod6.js b/cli/tests/subdir/mod6.js new file mode 100644 index 000000000..5e17c9ee0 --- /dev/null +++ b/cli/tests/subdir/mod6.js @@ -0,0 +1 @@ +export { isMod4 } from "./mod4.js"; -- cgit v1.2.3