summaryrefslogtreecommitdiff
path: root/tests/specs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/specs')
-rw-r--r--tests/specs/test/clean_flag/__test__.jsonc5
-rw-r--r--tests/specs/test/clean_flag/main.js23
-rw-r--r--tests/specs/test/clean_flag/main.out2
-rw-r--r--tests/specs/test/clean_flag/sum.js3
-rw-r--r--tests/specs/test/clean_flag/sum_test.js6
5 files changed, 39 insertions, 0 deletions
diff --git a/tests/specs/test/clean_flag/__test__.jsonc b/tests/specs/test/clean_flag/__test__.jsonc
new file mode 100644
index 000000000..65ad097b1
--- /dev/null
+++ b/tests/specs/test/clean_flag/__test__.jsonc
@@ -0,0 +1,5 @@
+{
+ "args": "run -A main.js",
+ "exitCode": 0,
+ "output": "main.out"
+}
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);
diff --git a/tests/specs/test/clean_flag/main.out b/tests/specs/test/clean_flag/main.out
new file mode 100644
index 000000000..bb101b641
--- /dev/null
+++ b/tests/specs/test/clean_flag/main.out
@@ -0,0 +1,2 @@
+true
+true
diff --git a/tests/specs/test/clean_flag/sum.js b/tests/specs/test/clean_flag/sum.js
new file mode 100644
index 000000000..506a41343
--- /dev/null
+++ b/tests/specs/test/clean_flag/sum.js
@@ -0,0 +1,3 @@
+export function sum(a, b) {
+ return a + b;
+}
diff --git a/tests/specs/test/clean_flag/sum_test.js b/tests/specs/test/clean_flag/sum_test.js
new file mode 100644
index 000000000..3443fcbd3
--- /dev/null
+++ b/tests/specs/test/clean_flag/sum_test.js
@@ -0,0 +1,6 @@
+import { sum } from "./sum.js";
+import { assertEquals } from "../../../util/std/assert/assert_equals.ts";
+
+Deno.test("sum()", () => {
+ assertEquals(sum(1, 2), 3);
+});