From f49d9556015a7d4c04e9db3f0c85d4399f6125ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 1 Dec 2020 23:33:44 +0100 Subject: 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. --- cli/tests/integration_tests.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'cli/tests/integration_tests.rs') 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 @@ -4600,6 +4600,42 @@ fn standalone_args() { assert_eq!(output.stdout, b"foo\n--bar\n--unstable\n"); } +#[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"); -- cgit v1.2.3