summaryrefslogtreecommitdiff
path: root/cli/tests/integration_tests.rs
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-02-13 08:41:51 +1100
committerGitHub <noreply@github.com>2020-02-12 16:41:51 -0500
commit6bd846a780bec8a60d0a251ed1fb43e3add81be5 (patch)
tree315452f40fc2b92c1f9f8ab9b860d4747fb4e0e0 /cli/tests/integration_tests.rs
parent3563ab4c53689480ac47871fe928ae7c78a2fcc3 (diff)
Improvements to bundling. (#3965)
Moves to using a minimal System loader for bundles generated by Deno. TypeScript in 3.8 will be able to output TLA for modules, and the loader is written to take advantage of that as soon as we update Deno to TS 3.8. System also allows us to support `import.meta` and provide more ESM aligned assignment of exports, as well as there is better handling of circular imports. The loader is also very terse versus to try to save overhead. Also, fixed an issue where abstract classes were not being re-exported. Fixes #2553 Fixes #3559 Fixes #3751 Fixes #3825 Refs #3301
Diffstat (limited to 'cli/tests/integration_tests.rs')
-rw-r--r--cli/tests/integration_tests.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index 013e4c41b..a41fdd032 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -252,6 +252,40 @@ fn bundle_exports() {
assert_eq!(output.stderr, b"");
}
+#[test]
+fn bundle_circular() {
+ use tempfile::TempDir;
+
+ // First we have to generate a bundle of some module that has exports.
+ let circular1 = util::root_path().join("cli/tests/subdir/circular1.ts");
+ assert!(circular1.is_file());
+ let t = TempDir::new().expect("tempdir fail");
+ let bundle = t.path().join("circular1.bundle.js");
+ let mut deno = util::deno_cmd()
+ .current_dir(util::root_path())
+ .arg("bundle")
+ .arg(circular1)
+ .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 the bundle program.
+ assert!(std::str::from_utf8(&output.stdout)
+ .unwrap()
+ .trim()
+ .ends_with("f1\nf2"));
+ assert_eq!(output.stderr, b"");
+}
+
// TODO(#2933): Rewrite this test in rust.
#[test]
fn repl_test() {