From 02822d309f6a3ca1a092670905605dd72f15b384 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 1 Nov 2023 15:59:51 -0400 Subject: fix(test): --junit-path should handle when the dir doesn't exist (#21044) Closes https://github.com/denoland/deno/issues/21022 --- cli/tools/test/reporters/junit.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cli/tools/test') 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) })?; -- cgit v1.2.3