diff options
author | Cooper Benson <skycoop@gmail.com> | 2023-07-26 16:12:35 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 00:12:35 +0200 |
commit | 0e4d6d41ad64b89ab72d87a778d1bf3e516efabc (patch) | |
tree | 0957cad56aef5df5c0932597c1b8a04ad9d1466d /cli/args/mod.rs | |
parent | cf16df00d9ba87de643abc6d80c860a2733917cc (diff) |
feat(cli): Adding JUnit test reports (#19747)
This commit makes the following changes
- Created a `CompoundTestReporter` to allow us to use multiple reporters
- Implements `JUnitTestReporter` which writes JUnit XML to a path
- Added a CLI flag/option `--junit` that enables JUnit reporting. By
default this writes the report to `stdout` (and disables pretty
reporting). If a path is provided, it will write the JUnit report to
that file while the pretty reporter writes to stdout like normal
Output of `deno -- test --allow-all --unstable
--location=http://js-unit-tests/foo/bar --junit
cli/tests/unit/testing_test.ts `
```xml
<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="deno test" tests="7" failures="0" errors="0" time="0.176">
<testsuite name="file:///Users/cooper/deno/deno/cli/tests/unit/testing_test.ts" tests="7" disabled="0" errors="0" failures="0">
<testcase name="testWrongOverloads" time="0.012">
</testcase>
<testcase name="nameOfTestCaseCantBeEmpty" time="0.009">
</testcase>
<testcase name="invalidStepArguments" time="0.008">
</testcase>
<testcase name="nameOnTextContext" time="0.029">
<properties>
<property name="step[passed]" value="step ... nested step"/>
<property name="step[passed]" value="step"/>
</properties>
</testcase>
<testcase name="originOnTextContext" time="0.030">
<properties>
<property name="step[passed]" value="step ... nested step"/>
<property name="step[passed]" value="step"/>
</properties>
</testcase>
<testcase name="parentOnTextContext" time="0.030">
<properties>
<property name="step[passed]" value="step ... nested step"/>
<property name="step[passed]" value="step"/>
</properties>
</testcase>
<testcase name="explicit undefined for boolean options" time="0.009">
</testcase>
</testsuite>
</testsuites>
```
Diffstat (limited to 'cli/args/mod.rs')
-rw-r--r-- | cli/args/mod.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 9a6050347..a979aa10c 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -227,6 +227,7 @@ pub struct TestOptions { pub shuffle: Option<u64>, pub concurrent_jobs: NonZeroUsize, pub trace_ops: bool, + pub junit_path: Option<String>, } impl TestOptions { @@ -251,6 +252,7 @@ impl TestOptions { no_run: test_flags.no_run, shuffle: test_flags.shuffle, trace_ops: test_flags.trace_ops, + junit_path: test_flags.junit_path, }) } } |