summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/test_tests.rs12
-rw-r--r--tests/testdata/test/junit_multiple_test_files.junit.out102
-rw-r--r--tests/testdata/test/nested_failures.junit.out47
-rw-r--r--tests/testdata/test/nested_failures.ts23
-rw-r--r--tests/testdata/test/pass.junit.out36
5 files changed, 202 insertions, 18 deletions
diff --git a/tests/integration/test_tests.rs b/tests/integration/test_tests.rs
index d5768b5ba..33abdf22c 100644
--- a/tests/integration/test_tests.rs
+++ b/tests/integration/test_tests.rs
@@ -283,6 +283,18 @@ itest!(junit {
output: "test/pass.junit.out",
});
+itest!(junit_nested {
+ args: "test --reporter junit test/nested_failures.ts",
+ output: "test/nested_failures.junit.out",
+ exit_code: 1,
+});
+
+itest!(junit_multiple_test_files {
+ args: "test --reporter junit test/pass.ts test/fail.ts",
+ output: "test/junit_multiple_test_files.junit.out",
+ exit_code: 1,
+});
+
#[test]
fn junit_path() {
let context = TestContextBuilder::new().use_temp_cwd().build();
diff --git a/tests/testdata/test/junit_multiple_test_files.junit.out b/tests/testdata/test/junit_multiple_test_files.junit.out
new file mode 100644
index 000000000..bf6f3eaa4
--- /dev/null
+++ b/tests/testdata/test/junit_multiple_test_files.junit.out
@@ -0,0 +1,102 @@
+Check file:///[WILDCARD]/test/pass.ts
+Check file:///[WILDCARD]/test/fail.ts
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuites name="deno test" tests="26" failures="10" errors="0" time="[WILDCARD]">
+ <testsuite name="./test/pass.ts" tests="16" disabled="0" errors="0" failures="0">
+ <testcase name="test 0" classname="./test/pass.ts" time="[WILDCARD]" line="1" col="6">
+ </testcase>
+ <testcase name="test 1" classname="./test/pass.ts" time="[WILDCARD]" line="2" col="6">
+ </testcase>
+ <testcase name="test 2" classname="./test/pass.ts" time="[WILDCARD]" line="3" col="6">
+ </testcase>
+ <testcase name="test 3" classname="./test/pass.ts" time="[WILDCARD]" line="4" col="6">
+ </testcase>
+ <testcase name="test 4" classname="./test/pass.ts" time="[WILDCARD]" line="5" col="6">
+ </testcase>
+ <testcase name="test 5" classname="./test/pass.ts" time="[WILDCARD]" line="6" col="6">
+ </testcase>
+ <testcase name="test 6" classname="./test/pass.ts" time="[WILDCARD]" line="7" col="6">
+ </testcase>
+ <testcase name="test 7" classname="./test/pass.ts" time="[WILDCARD]" line="8" col="6">
+ </testcase>
+ <testcase name="test 8" classname="./test/pass.ts" time="[WILDCARD]" line="9" col="6">
+ </testcase>
+ <testcase name="test 9" classname="./test/pass.ts" time="[WILDCARD]" line="12" col="6">
+ </testcase>
+ <testcase name="test\b" classname="./test/pass.ts" time="[WILDCARD]" line="16" col="6">
+ </testcase>
+ <testcase name="test\f" classname="./test/pass.ts" time="[WILDCARD]" line="19" col="6">
+ </testcase>
+ <testcase name="test\t" classname="./test/pass.ts" time="[WILDCARD]" line="23" col="6">
+ </testcase>
+ <testcase name="test\n" classname="./test/pass.ts" time="[WILDCARD]" line="27" col="6">
+ </testcase>
+ <testcase name="test\r" classname="./test/pass.ts" time="[WILDCARD]" line="31" col="6">
+ </testcase>
+ <testcase name="test\v" classname="./test/pass.ts" time="[WILDCARD]" line="35" col="6">
+ </testcase>
+ </testsuite>
+ <testsuite name="./test/fail.ts" tests="10" disabled="0" errors="0" failures="10">
+ <testcase name="test 0" classname="./test/fail.ts" time="[WILDCARD]" line="1" col="6">
+ <failure message="Uncaught Error">Error
+ throw new Error();
+ ^
+ at file:///[WILDCARD]/test/fail.ts:2:9</failure>
+ </testcase>
+ <testcase name="test 1" classname="./test/fail.ts" time="[WILDCARD]" line="4" col="6">
+ <failure message="Uncaught Error">Error
+ throw new Error();
+ ^
+ at file:///[WILDCARD]/test/fail.ts:5:9</failure>
+ </testcase>
+ <testcase name="test 2" classname="./test/fail.ts" time="[WILDCARD]" line="7" col="6">
+ <failure message="Uncaught Error">Error
+ throw new Error();
+ ^
+ at file:///[WILDCARD]/test/fail.ts:8:9</failure>
+ </testcase>
+ <testcase name="test 3" classname="./test/fail.ts" time="[WILDCARD]" line="10" col="6">
+ <failure message="Uncaught Error">Error
+ throw new Error();
+ ^
+ at file:///[WILDCARD]/test/fail.ts:11:9</failure>
+ </testcase>
+ <testcase name="test 4" classname="./test/fail.ts" time="[WILDCARD]" line="13" col="6">
+ <failure message="Uncaught Error">Error
+ throw new Error();
+ ^
+ at file:///[WILDCARD]/test/fail.ts:14:9</failure>
+ </testcase>
+ <testcase name="test 5" classname="./test/fail.ts" time="[WILDCARD]" line="16" col="6">
+ <failure message="Uncaught Error">Error
+ throw new Error();
+ ^
+ at file:///[WILDCARD]/test/fail.ts:17:9</failure>
+ </testcase>
+ <testcase name="test 6" classname="./test/fail.ts" time="[WILDCARD]" line="19" col="6">
+ <failure message="Uncaught Error">Error
+ throw new Error();
+ ^
+ at file:///[WILDCARD]/test/fail.ts:20:9</failure>
+ </testcase>
+ <testcase name="test 7" classname="./test/fail.ts" time="[WILDCARD]" line="22" col="6">
+ <failure message="Uncaught Error">Error
+ throw new Error();
+ ^
+ at file:///[WILDCARD]/test/fail.ts:23:9</failure>
+ </testcase>
+ <testcase name="test 8" classname="./test/fail.ts" time="[WILDCARD]" line="25" col="6">
+ <failure message="Uncaught Error">Error
+ throw new Error();
+ ^
+ at file:///[WILDCARD]/test/fail.ts:26:9</failure>
+ </testcase>
+ <testcase name="test 9" classname="./test/fail.ts" time="[WILDCARD]" line="28" col="6">
+ <failure message="Uncaught Error">Error
+ throw new Error();
+ ^
+ at file:///[WILDCARD]/test/fail.ts:29:9</failure>
+ </testcase>
+ </testsuite>
+</testsuites>
+error: Test failed
diff --git a/tests/testdata/test/nested_failures.junit.out b/tests/testdata/test/nested_failures.junit.out
new file mode 100644
index 000000000..3e4d3c0d4
--- /dev/null
+++ b/tests/testdata/test/nested_failures.junit.out
@@ -0,0 +1,47 @@
+Check file:///[WILDCARD]/test/nested_failures.ts
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuites name="deno test" tests="11" failures="6" errors="0" time="[WILDCARD]">
+ <testsuite name="./test/nested_failures.ts" tests="11" disabled="0" errors="0" failures="6">
+ <testcase name="parent 1" classname="./test/nested_failures.ts" time="[WILDCARD]" line="1" col="6">
+ <failure message="1 test step failed">1 test step failed.</failure>
+ </testcase>
+ <testcase name="parent 2" classname="./test/nested_failures.ts" time="[WILDCARD]" line="8" col="6">
+ <failure message="2 test steps failed">2 test steps failed.</failure>
+ </testcase>
+ <testcase name="parent 3" classname="./test/nested_failures.ts" time="[WILDCARD]" line="20" col="6">
+ </testcase>
+ <testcase name="parent 1 &gt; child 1" classname="./test/nested_failures.ts" time="[WILDCARD]" line="2" col="11">
+ </testcase>
+ <testcase name="parent 1 &gt; child 2" classname="./test/nested_failures.ts" time="[WILDCARD]" line="3" col="11">
+ <failure message="Uncaught Error: Fail.">Error: Fail.
+ throw new Error(&quot;Fail.&quot;);
+ ^
+ at file:///[WILDCARD]/test/nested_failures.ts:4:11
+ [WILDCARD]</failure>
+ </testcase>
+ <testcase name="parent 2 &gt; child 1" classname="./test/nested_failures.ts" time="[WILDCARD]" line="9" col="11">
+ <failure message="1 test step failed">1 test step failed.</failure>
+ </testcase>
+ <testcase name="parent 2 &gt; child 1 &gt; grandchild 1" classname="[WILDCARD]/test/nested_failures.ts" time="[WILDCARD]" line="10" col="13">
+ </testcase>
+ <testcase name="parent 2 &gt; child 1 &gt; grandchild 2" classname="[WILDCARD]/test/nested_failures.ts" time="[WILDCARD]" line="11" col="13">
+ <failure message="Uncaught Error: Fail.">Error: Fail.
+ throw new Error(&quot;Fail.&quot;);
+ ^
+ at file:///[WILDCARD]/test/nested_failures.ts:12:13
+ [WILDCARD]</failure>
+ </testcase>
+ <testcase name="parent 2 &gt; child 2" classname="./test/nested_failures.ts" time="[WILDCARD]" line="15" col="11">
+ <failure message="Uncaught Error: Fail.">Error: Fail.
+ throw new Error(&quot;Fail.&quot;);
+ ^
+ at file:///[WILDCARD]/test/nested_failures.ts:16:11
+ [WILDCARD]</failure>
+ </testcase>
+ <testcase name="parent 3 &gt; child 1" classname="./test/nested_failures.ts" time="[WILDCARD]" line="21" col="11">
+ </testcase>
+ <testcase name="parent 3 &gt; child 2" classname="./test/nested_failures.ts" time="[WILDCARD]" line="22" col="11">
+ </testcase>
+ </testsuite>
+</testsuites>
+error: Test failed
diff --git a/tests/testdata/test/nested_failures.ts b/tests/testdata/test/nested_failures.ts
new file mode 100644
index 000000000..128e48aef
--- /dev/null
+++ b/tests/testdata/test/nested_failures.ts
@@ -0,0 +1,23 @@
+Deno.test("parent 1", async (t) => {
+ await t.step("child 1", () => {});
+ await t.step("child 2", () => {
+ throw new Error("Fail.");
+ });
+});
+
+Deno.test("parent 2", async (t) => {
+ await t.step("child 1", async (t) => {
+ await t.step("grandchild 1", () => {});
+ await t.step("grandchild 2", () => {
+ throw new Error("Fail.");
+ });
+ });
+ await t.step("child 2", () => {
+ throw new Error("Fail.");
+ });
+});
+
+Deno.test("parent 3", async (t) => {
+ await t.step("child 1", () => {});
+ await t.step("child 2", () => {});
+});
diff --git a/tests/testdata/test/pass.junit.out b/tests/testdata/test/pass.junit.out
index b652dbf85..af9fd6f6b 100644
--- a/tests/testdata/test/pass.junit.out
+++ b/tests/testdata/test/pass.junit.out
@@ -1,38 +1,38 @@
-Check [WILDCARD]/testdata/test/pass.ts
+Check file:///[WILDCARD]/test/pass.ts
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="deno test" tests="16" failures="0" errors="0" time="[WILDCARD]">
- <testsuite name="[WILDCARD]/testdata/test/pass.ts" tests="16" disabled="0" errors="0" failures="0">
- <testcase name="test 0" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="1" col="6">
+ <testsuite name="./test/pass.ts" tests="16" disabled="0" errors="0" failures="0">
+ <testcase name="test 0" classname="./test/pass.ts" time="[WILDCARD]" line="1" col="6">
</testcase>
- <testcase name="test 1" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="2" col="6">
+ <testcase name="test 1" classname="./test/pass.ts" time="[WILDCARD]" line="2" col="6">
</testcase>
- <testcase name="test 2" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="3" col="6">
+ <testcase name="test 2" classname="./test/pass.ts" time="[WILDCARD]" line="3" col="6">
</testcase>
- <testcase name="test 3" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="4" col="6">
+ <testcase name="test 3" classname="./test/pass.ts" time="[WILDCARD]" line="4" col="6">
</testcase>
- <testcase name="test 4" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="5" col="6">
+ <testcase name="test 4" classname="./test/pass.ts" time="[WILDCARD]" line="5" col="6">
</testcase>
- <testcase name="test 5" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="6" col="6">
+ <testcase name="test 5" classname="./test/pass.ts" time="[WILDCARD]" line="6" col="6">
</testcase>
- <testcase name="test 6" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="7" col="6">
+ <testcase name="test 6" classname="./test/pass.ts" time="[WILDCARD]" line="7" col="6">
</testcase>
- <testcase name="test 7" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="8" col="6">
+ <testcase name="test 7" classname="./test/pass.ts" time="[WILDCARD]" line="8" col="6">
</testcase>
- <testcase name="test 8" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="9" col="6">
+ <testcase name="test 8" classname="./test/pass.ts" time="[WILDCARD]" line="9" col="6">
</testcase>
- <testcase name="test 9" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="12" col="6">
+ <testcase name="test 9" classname="./test/pass.ts" time="[WILDCARD]" line="12" col="6">
</testcase>
- <testcase name="test\b" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="16" col="6">
+ <testcase name="test\b" classname="./test/pass.ts" time="[WILDCARD]" line="16" col="6">
</testcase>
- <testcase name="test\f" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="19" col="6">
+ <testcase name="test\f" classname="./test/pass.ts" time="[WILDCARD]" line="19" col="6">
</testcase>
- <testcase name="test\t" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="23" col="6">
+ <testcase name="test\t" classname="./test/pass.ts" time="[WILDCARD]" line="23" col="6">
</testcase>
- <testcase name="test\n" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="27" col="6">
+ <testcase name="test\n" classname="./test/pass.ts" time="[WILDCARD]" line="27" col="6">
</testcase>
- <testcase name="test\r" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="31" col="6">
+ <testcase name="test\r" classname="./test/pass.ts" time="[WILDCARD]" line="31" col="6">
</testcase>
- <testcase name="test\v" time="[WILDCARD]" filename="[WILDCARD]/testdata/test/pass.ts" line="35" col="6">
+ <testcase name="test\v" classname="./test/pass.ts" time="[WILDCARD]" line="35" col="6">
</testcase>
</testsuite>
</testsuites>