summaryrefslogtreecommitdiff
path: root/cli/main.rs
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2024-05-23 13:04:12 +1000
committerGitHub <noreply@github.com>2024-05-23 03:04:12 +0000
commit71375491d135b7e5e48a09a39317aa7510594a35 (patch)
tree269474a0e0a56f8f7fe97e8fbadaaa4617a1ed0e /cli/main.rs
parentfab4c1776b0f212f0a9f5b82842115b9b7e87d4b (diff)
feat(cli/test): `deno test --clean` (#23519)
The result of the call is ignored as it throws even when the directory does not exist. Closes #23491
Diffstat (limited to 'cli/main.rs')
-rw-r--r--cli/main.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/cli/main.rs b/cli/main.rs
index 44e9d31fd..a2d270d40 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -191,6 +191,9 @@ async fn run_subcommand(flags: Flags) -> Result<i32, AnyError> {
DenoSubcommand::Test(test_flags) => {
spawn_subcommand(async {
if let Some(ref coverage_dir) = test_flags.coverage_dir {
+ if test_flags.clean {
+ let _ = std::fs::remove_dir_all(coverage_dir);
+ }
std::fs::create_dir_all(coverage_dir)
.with_context(|| format!("Failed creating: {coverage_dir}"))?;
// this is set in order to ensure spawned processes use the same