summaryrefslogtreecommitdiff
path: root/cli/tests/integration_tests.rs
diff options
context:
space:
mode:
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 9cdf0af56..29203d411 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -399,6 +399,40 @@ fn bundle_single_module() {
}
#[test]
+fn bundle_json() {
+ use tempfile::TempDir;
+
+ let json_modules = util::root_path().join("cli/tests/020_json_modules.ts");
+ assert!(json_modules.is_file());
+ let t = TempDir::new().expect("tempdir fail");
+ let bundle = t.path().join("020_json_modules.bundle.js");
+ let mut deno = util::deno_cmd()
+ .current_dir(util::root_path())
+ .arg("bundle")
+ .arg(json_modules)
+ .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("--reload")
+ .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("{\"foo\":{\"bar\":true,\"baz\":[\"qat\",1]}}"));
+ assert_eq!(output.stderr, b"");
+}
+
+#[test]
fn bundle_tla() {
// First we have to generate a bundle of some module that has exports.
let tla_import = util::root_path().join("cli/tests/subdir/tla.ts");