1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 07:44:48 -05:00

fix(test): ensure coverage dir exists (#10717)

This commit is contained in:
Yoshiya Hinosawa 2021-05-21 22:57:00 +09:00 committed by Bert Belder
parent 7b1fd3d146
commit 195808a538
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461
2 changed files with 5 additions and 3 deletions

View file

@ -925,6 +925,7 @@ async fn test_command(
concurrent_jobs: usize, concurrent_jobs: usize,
) -> Result<(), AnyError> { ) -> Result<(), AnyError> {
if let Some(ref coverage_dir) = flags.coverage_dir { if let Some(ref coverage_dir) = flags.coverage_dir {
std::fs::create_dir_all(&coverage_dir)?;
env::set_var( env::set_var(
"DENO_UNSTABLE_COVERAGE_DIR", "DENO_UNSTABLE_COVERAGE_DIR",
PathBuf::from(coverage_dir).canonicalize()?, PathBuf::from(coverage_dir).canonicalize()?,

View file

@ -4425,12 +4425,13 @@ console.log("finish");
#[test] #[test]
fn branch() { fn branch() {
let tempdir = 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()
.current_dir(util::root_path()) .current_dir(util::root_path())
.arg("test") .arg("test")
.arg("--quiet") .arg("--quiet")
.arg("--unstable") .arg("--unstable")
.arg(format!("--coverage={}", tempdir.path().to_str().unwrap())) .arg(format!("--coverage={}", tempdir.to_str().unwrap()))
.arg("cli/tests/coverage/branch_test.ts") .arg("cli/tests/coverage/branch_test.ts")
.stdout(std::process::Stdio::piped()) .stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::inherit()) .stderr(std::process::Stdio::inherit())
@ -4444,7 +4445,7 @@ console.log("finish");
.arg("coverage") .arg("coverage")
.arg("--quiet") .arg("--quiet")
.arg("--unstable") .arg("--unstable")
.arg(format!("{}/", tempdir.path().to_str().unwrap())) .arg(format!("{}/", tempdir.to_str().unwrap()))
.stdout(std::process::Stdio::piped()) .stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::inherit()) .stderr(std::process::Stdio::inherit())
.output() .output()
@ -4473,7 +4474,7 @@ console.log("finish");
.arg("--quiet") .arg("--quiet")
.arg("--unstable") .arg("--unstable")
.arg("--lcov") .arg("--lcov")
.arg(format!("{}/", tempdir.path().to_str().unwrap())) .arg(format!("{}/", tempdir.to_str().unwrap()))
.stdout(std::process::Stdio::piped()) .stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::inherit()) .stderr(std::process::Stdio::inherit())
.output() .output()