summaryrefslogtreecommitdiff
path: root/cli/js/compiler_api_test.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-03-03 08:18:27 +1100
committerGitHub <noreply@github.com>2020-03-02 22:18:27 +0100
commit83d902a7803adb0c69fe2c98e692a50dae446db9 (patch)
tree75d15519f15748a0c3d016d0ed4e8f1d8389185d /cli/js/compiler_api_test.ts
parenta3c3a56ff71c325ea4807548484023c95ffdcd77 (diff)
Fix JavaScript dependencies in bundles. (#4215)
Fixes #4602 We turned off `allowJs` by default, to keep the compiler from grabbing a bunch of files that it wouldn't actually do anything useful with. On the other hand, this caused problems with bundles, where the compiler needs to gather all the dependencies, including JavaScript ones. This fixes this so that when we are bundling, we analyse JavaScript imports in the compiler.
Diffstat (limited to 'cli/js/compiler_api_test.ts')
-rw-r--r--cli/js/compiler_api_test.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/cli/js/compiler_api_test.ts b/cli/js/compiler_api_test.ts
index 64ba70afb..fcca0a22b 100644
--- a/cli/js/compiler_api_test.ts
+++ b/cli/js/compiler_api_test.ts
@@ -135,6 +135,15 @@ test(async function bundleApiConfig() {
assert(!actual.includes(`random`));
});
+test(async function bundleApiJsModules() {
+ const [diagnostics, actual] = await bundle("/foo.js", {
+ "/foo.js": `export * from "./bar.js";\n`,
+ "/bar.js": `export const bar = "bar";\n`
+ });
+ assert(diagnostics == null);
+ assert(actual.includes(`System.register("bar",`));
+});
+
test(async function diagnosticsTest() {
const [diagnostics] = await compile("/foo.ts", {
"/foo.ts": `document.getElementById("foo");`