summaryrefslogtreecommitdiff
path: root/cli/tests/integration_tests.rs
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/tests/integration_tests.rs
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/tests/integration_tests.rs')
-rw-r--r--cli/tests/integration_tests.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index d7e807793..a475e9111 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -437,6 +437,36 @@ fn bundle_tla() {
}
#[test]
+fn bundle_js() {
+ use tempfile::TempDir;
+
+ // First we have to generate a bundle of some module that has exports.
+ let mod6 = util::root_path().join("cli/tests/subdir/mod6.js");
+ assert!(mod6.is_file());
+ let t = TempDir::new().expect("tempdir fail");
+ let bundle = t.path().join("mod6.bundle.js");
+ let mut deno = util::deno_cmd()
+ .current_dir(util::root_path())
+ .arg("bundle")
+ .arg(mod6)
+ .arg(&bundle)
+ .spawn()
+ .expect("failed to spawn script");
+ let status = deno.wait().expect("failed to wait for the child process");
+ assert!(status.success());
+ assert!(bundle.is_file());
+
+ let output = util::deno_cmd()
+ .current_dir(util::root_path())
+ .arg("run")
+ .arg(&bundle)
+ .output()
+ .expect("failed to spawn script");
+ // check that nothing went to stderr
+ assert_eq!(output.stderr, b"");
+}
+
+#[test]
fn repl_test_console_log() {
let (out, err, code) = util::run_and_collect_output(
"repl",