summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-12-01 23:33:44 +0100
committerGitHub <noreply@github.com>2020-12-01 23:33:44 +0100
commitf49d9556015a7d4c04e9db3f0c85d4399f6125ff (patch)
tree7719c7b14d559928b5177301e1e83522c2222c97 /cli/tests
parent6e03917b51217524a894e5094933d551dc5ac0d9 (diff)
fix(compile): disable source mapping of errors (#8581)
This commit disables source mapping of errors for standalone binaries. Since applying source maps relies on using file fetcher infrastructure it's not feasible to use it for standalone binaries that are not supposed to use that infrastructure.
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration_tests.rs36
-rw-r--r--cli/tests/standalone_error.ts9
2 files changed, 45 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index 4b8d274c7..c99033020 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -4601,6 +4601,42 @@ fn standalone_args() {
}
#[test]
+fn standalone_error() {
+ let dir = TempDir::new().expect("tempdir fail");
+ let exe = if cfg!(windows) {
+ dir.path().join("error.exe")
+ } else {
+ dir.path().join("error")
+ };
+ let output = util::deno_cmd()
+ .current_dir(util::root_path())
+ .arg("compile")
+ .arg("--unstable")
+ .arg("--output")
+ .arg(&exe)
+ .arg("./cli/tests/standalone_error.ts")
+ .stdout(std::process::Stdio::piped())
+ .spawn()
+ .unwrap()
+ .wait_with_output()
+ .unwrap();
+ assert!(output.status.success());
+ let output = Command::new(exe)
+ .env("NO_COLOR", "1")
+ .stdout(std::process::Stdio::piped())
+ .stderr(std::process::Stdio::piped())
+ .spawn()
+ .unwrap()
+ .wait_with_output()
+ .unwrap();
+ assert!(!output.status.success());
+ assert_eq!(output.stdout, b"");
+ let expected_stderr = "error: Error: boom!\n at boom (file://$deno$/bundle.js:2:11)\n at foo (file://$deno$/bundle.js:5:5)\n at file://$deno$/bundle.js:7:1\n";
+ let stderr = String::from_utf8(output.stderr).unwrap();
+ assert_eq!(stderr, expected_stderr);
+}
+
+#[test]
fn standalone_no_module_load() {
let dir = TempDir::new().expect("tempdir fail");
let exe = if cfg!(windows) {
diff --git a/cli/tests/standalone_error.ts b/cli/tests/standalone_error.ts
new file mode 100644
index 000000000..279398113
--- /dev/null
+++ b/cli/tests/standalone_error.ts
@@ -0,0 +1,9 @@
+function boom() {
+ throw new Error("boom!");
+}
+
+function foo() {
+ boom();
+}
+
+foo();