diff options
| author | David Sherret <dsherret@users.noreply.github.com> | 2023-11-01 15:59:51 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-01 19:59:51 +0000 |
| commit | 02822d309f6a3ca1a092670905605dd72f15b384 (patch) | |
| tree | bee2e50ac74f5c0e99cd73bba63f076048cd833e /cli/tools | |
| parent | d42f1543121e7245789a96a485d1ef7645cb5fba (diff) | |
fix(test): --junit-path should handle when the dir doesn't exist (#21044)
Closes https://github.com/denoland/deno/issues/21022
Diffstat (limited to 'cli/tools')
| -rw-r--r-- | cli/tools/test/reporters/junit.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cli/tools/test/reporters/junit.rs b/cli/tools/test/reporters/junit.rs index a62c32dab..c345f3697 100644 --- a/cli/tools/test/reporters/junit.rs +++ b/cli/tools/test/reporters/junit.rs @@ -1,5 +1,7 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. +use std::path::PathBuf; + use super::*; pub struct JunitTestReporter { @@ -191,10 +193,8 @@ impl TestReporter for JunitTestReporter { .serialize(std::io::stdout()) .with_context(|| "Failed to write JUnit report to stdout")?; } else { - let file = - std::fs::File::create(self.path.clone()).with_context(|| { - format!("Failed to open JUnit report file {}", self.path) - })?; + let file = crate::util::fs::create_file(&PathBuf::from(&self.path)) + .context("Failed to open JUnit report file.")?; report.serialize(file).with_context(|| { format!("Failed to write JUnit report to {}", self.path) })?; |
