diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-04-02 14:14:30 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-01 23:14:30 -0400 |
commit | 2e24385c487d5471aceae7d7e7de9da4c7d87064 (patch) | |
tree | 8337f0df8c3ba8078bd7112ff61f5e082025f664 /cli/tests/integration_tests.rs | |
parent | 2ff8012dccf648916212918c69f6b5d7b6dedc56 (diff) |
Support dynamic import in bundles. (#4561)
Diffstat (limited to 'cli/tests/integration_tests.rs')
-rw-r--r-- | cli/tests/integration_tests.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 8342da108..98c564b4d 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -491,6 +491,38 @@ fn bundle_js() { } #[test] +fn bundle_dynamic_import() { + let dynamic_import = + util::root_path().join("cli/tests/subdir/subdir2/dynamic_import.ts"); + assert!(dynamic_import.is_file()); + let t = TempDir::new().expect("tempdir fail"); + let bundle = t.path().join("dynamic_import.bundle.js"); + let mut deno = util::deno_cmd() + .current_dir(util::root_path()) + .arg("bundle") + .arg(dynamic_import) + .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 the output of the test.ts program. + assert!(std::str::from_utf8(&output.stdout) + .unwrap() + .trim() + .ends_with("Hello")); + assert_eq!(output.stderr, b""); +} + +#[test] fn repl_test_console_log() { let (out, err) = util::run_and_collect_output( true, |