diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-10-25 07:02:11 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-25 07:02:11 +1100 |
commit | 117fcf61f0feb8d50b3b55f7698929b633980643 (patch) | |
tree | b89973bd2c734af5d902cdf893430025a30f6b34 /cli/tests | |
parent | 9adbca6d195b8ea9ad1474ebbb6f906069d6b130 (diff) |
test(cli): dynamic imports not evaluated until runtime (#8102)
Closes #7997
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/dynamic_import_conditional.js | 3 | ||||
-rw-r--r-- | cli/tests/dynamic_import_conditional.js.out | 1 | ||||
-rw-r--r-- | cli/tests/integration_tests.rs | 5 |
3 files changed, 9 insertions, 0 deletions
diff --git a/cli/tests/dynamic_import_conditional.js b/cli/tests/dynamic_import_conditional.js new file mode 100644 index 000000000..1b4193e3e --- /dev/null +++ b/cli/tests/dynamic_import_conditional.js @@ -0,0 +1,3 @@ +const Worker = globalThis.Worker ?? (await import("worker_threads")).Worker; + +console.log(!!Worker); diff --git a/cli/tests/dynamic_import_conditional.js.out b/cli/tests/dynamic_import_conditional.js.out new file mode 100644 index 000000000..27ba77dda --- /dev/null +++ b/cli/tests/dynamic_import_conditional.js.out @@ -0,0 +1 @@ +true diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 11240e71b..d88309cb2 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2762,6 +2762,11 @@ itest!(disallow_http_from_https_ts { exit_code: 1, }); +itest!(dynamic_import_conditional { + args: "run --quiet --reload dynamic_import_conditional.js", + output: "dynamic_import_conditional.js.out", +}); + itest!(tsx_imports { args: "run --reload tsx_imports.ts", output: "tsx_imports.ts.out", |