summaryrefslogtreecommitdiff
path: root/tests/specs/test/clean_flag/main.js
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 /tests/specs/test/clean_flag/main.js
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 'tests/specs/test/clean_flag/main.js')
-rw-r--r--tests/specs/test/clean_flag/main.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/specs/test/clean_flag/main.js b/tests/specs/test/clean_flag/main.js
new file mode 100644
index 000000000..215c2229c
--- /dev/null
+++ b/tests/specs/test/clean_flag/main.js
@@ -0,0 +1,23 @@
+import { emptyDir } from "../../../util/std/fs/empty_dir.ts";
+
+const DIR = "./coverage";
+const COMMAND = new Deno.Command(Deno.execPath(), {
+ args: ["test", "--coverage", "--clean"],
+ stdout: "null",
+});
+
+async function getCoverageFiles() {
+ return await Array.fromAsync(Deno.readDir(DIR), ({ name }) => name);
+}
+
+await emptyDir(DIR);
+await COMMAND.output();
+const files1 = new Set(await getCoverageFiles());
+
+await COMMAND.output();
+const files2 = new Set(await getCoverageFiles());
+
+console.log(files1.size === files2.size);
+console.log(files1.intersection(files2).size === 0);
+await emptyDir(DIR);
+await Deno.remove(DIR);