diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-06-10 16:02:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-10 16:02:41 +0200 |
commit | 4b7d3b060e88c02bc0ca12664f52111a4666b167 (patch) | |
tree | 018968e67c8d34c5cffe73578643eb071fa103b0 /cli/tests | |
parent | f364a4c2b6dcce65959af2da3663f0b4a7338229 (diff) |
fix: several regressions in TS compiler (#6177)
This commit fixes several regressions in TS compiler:
* double compilation of same module during same process run
* compilation of JavaScript entry point with non-JS imports
* unexpected skip of emit during compilation
Additional checks were added to ensure "allowJs" setting is
used in TS compiler if JavaScript has non-JS dependencies.
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/single_compile_with_reload.ts | 4 | ||||
-rw-r--r-- | cli/tests/single_compile_with_reload.ts.out | 5 | ||||
-rw-r--r-- | cli/tests/ts_import_from_js.deps.js | 2 | ||||
-rw-r--r-- | cli/tests/ts_import_from_js.js | 4 | ||||
-rw-r--r-- | cli/tests/ts_import_from_js.js.out | 2 |
6 files changed, 22 insertions, 1 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index c62a9a501..fafce3eb0 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -1938,6 +1938,12 @@ itest!(cjs_imports { itest!(ts_import_from_js { args: "run --quiet --reload ts_import_from_js.js", output: "ts_import_from_js.js.out", + http_server: true, +}); + +itest!(single_compile_with_reload { + args: "run --reload --allow-read single_compile_with_reload.ts", + output: "single_compile_with_reload.ts.out", }); itest!(proto_exploit { diff --git a/cli/tests/single_compile_with_reload.ts b/cli/tests/single_compile_with_reload.ts new file mode 100644 index 000000000..3dd728366 --- /dev/null +++ b/cli/tests/single_compile_with_reload.ts @@ -0,0 +1,4 @@ +await import("./005_more_imports.ts"); +console.log("1"); +await import("./005_more_imports.ts"); +console.log("2"); diff --git a/cli/tests/single_compile_with_reload.ts.out b/cli/tests/single_compile_with_reload.ts.out new file mode 100644 index 000000000..2cdd71673 --- /dev/null +++ b/cli/tests/single_compile_with_reload.ts.out @@ -0,0 +1,5 @@ +Compile [WILDCARD]single_compile_with_reload.ts +Compile [WILDCARD]005_more_imports.ts +Hello +1 +2 diff --git a/cli/tests/ts_import_from_js.deps.js b/cli/tests/ts_import_from_js.deps.js new file mode 100644 index 000000000..bfea5ac79 --- /dev/null +++ b/cli/tests/ts_import_from_js.deps.js @@ -0,0 +1,2 @@ +import "./005_more_imports.ts"; +export { printHello } from "http://localhost:4545/cli/tests/subdir/mod2.ts"; diff --git a/cli/tests/ts_import_from_js.js b/cli/tests/ts_import_from_js.js index e06ca15a2..f912c2723 100644 --- a/cli/tests/ts_import_from_js.js +++ b/cli/tests/ts_import_from_js.js @@ -1 +1,3 @@ -import "./005_more_imports.ts"; +import { printHello } from "./ts_import_from_js.deps.js"; +printHello(); +console.log("success"); diff --git a/cli/tests/ts_import_from_js.js.out b/cli/tests/ts_import_from_js.js.out index e965047ad..e1d7a869f 100644 --- a/cli/tests/ts_import_from_js.js.out +++ b/cli/tests/ts_import_from_js.js.out @@ -1 +1,3 @@ Hello +Hello +success |