From a3b3a792b5c8dd2fa3e1b29f7fe5a7f3423f25c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 10 Jan 2022 17:36:58 +0100 Subject: fix(coverage): don't type check (#13324) This commit changes "deno coverage" command not to type check. Instead of relying on infrastructure for module loading in "deno run"; the code now directly reaches into cache for original and transpiled sources. In case sources are not available the error is returned to the user, suggesting to first run "deno test --coverage" command. --- cli/tests/integration/coverage_tests.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'cli/tests/integration/coverage_tests.rs') diff --git a/cli/tests/integration/coverage_tests.rs b/cli/tests/integration/coverage_tests.rs index feba0769e..637185e29 100644 --- a/cli/tests/integration/coverage_tests.rs +++ b/cli/tests/integration/coverage_tests.rs @@ -20,9 +20,11 @@ fn final_blankline() { } fn run_coverage_text(test_name: &str, extension: &str) { + let deno_dir = TempDir::new().expect("tempdir fail"); let tempdir = TempDir::new().expect("tempdir fail"); let tempdir = tempdir.path().join("cov"); - let status = util::deno_cmd() + + let status = util::deno_cmd_with_deno_dir(deno_dir.path()) .current_dir(util::testdata_path()) .arg("test") .arg("--quiet") @@ -36,17 +38,19 @@ fn run_coverage_text(test_name: &str, extension: &str) { assert!(status.success()); - let output = util::deno_cmd() + let output = util::deno_cmd_with_deno_dir(deno_dir.path()) .current_dir(util::testdata_path()) .arg("coverage") - .arg("--quiet") .arg("--unstable") .arg(format!("{}/", tempdir.to_str().unwrap())) .stdout(std::process::Stdio::piped()) - .stderr(std::process::Stdio::inherit()) + .stderr(std::process::Stdio::piped()) .output() .expect("failed to spawn coverage reporter"); + // Verify there's no "Check" being printed + assert!(output.stderr.is_empty()); + let actual = util::strip_ansi_codes(std::str::from_utf8(&output.stdout).unwrap()) .to_string(); @@ -64,7 +68,7 @@ fn run_coverage_text(test_name: &str, extension: &str) { assert!(output.status.success()); - let output = util::deno_cmd() + let output = util::deno_cmd_with_deno_dir(deno_dir.path()) .current_dir(util::testdata_path()) .arg("coverage") .arg("--quiet") -- cgit v1.2.3