Fix edge case of one test assembly

This commit is contained in:
Ray Xu 2022-05-06 04:34:02 +00:00 committed by Zach Renner
parent 3608ee03fd
commit 724497a84c
14 changed files with 65 additions and 6 deletions

View file

@ -1,4 +1,7 @@
![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%204%20failed%2C%201%20skipped-critical)
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|fixtures/dart-json.json|1:white_check_mark:|4:x:|1:warning:|4s|
## :x: <a id="user-content-r0" href="#r0">fixtures/dart-json.json</a>
**6** tests were completed in **4s** with **1** passed, **4** failed and **1** skipped.
|Test suite|Passed|Failed|Skipped|Time|

View file

@ -1,4 +1,7 @@
![Tests failed](https://img.shields.io/badge/tests-5%20passed%2C%205%20failed%2C%201%20skipped-critical)
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|DotnetTests.XUnitTests|5:white_check_mark:|5:x:|1:warning:|1s|
## :x: <a id="user-content-r0" href="#r0">DotnetTests.XUnitTests</a>
**11** tests were completed in **1s** with **5** passed, **5** failed and **1** skipped.
|Test suite|Passed|Failed|Skipped|Time|

View file

@ -1,4 +1,9 @@
![Tests passed successfully](https://img.shields.io/badge/tests-803%20passed%2C%201%20skipped-success)
<details><summary>Expand for details</summary>
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|FluentValidation.Tests|803:white_check_mark:||1:warning:|4s|
## :white_check_mark: <a id="user-content-r0" href="#r0">FluentValidation.Tests</a>
**804** tests were completed in **4s** with **803** passed, **0** failed and **1** skipped.
|Test suite|Passed|Failed|Skipped|Time|
@ -1055,3 +1060,4 @@
:white_check_mark: Unexpected_severity_check
:white_check_mark: Unexpected_state_check
```
</details>

View file

@ -1,4 +1,7 @@
![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%204%20failed%2C%201%20skipped-critical)
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|fixtures/jest-junit.xml|1:white_check_mark:|4:x:|1:warning:|1s|
## :x: <a id="user-content-r0" href="#r0">fixtures/jest-junit.xml</a>
**6** tests were completed in **1s** with **1** passed, **4** failed and **1** skipped.
|Test suite|Passed|Failed|Skipped|Time|

View file

@ -1,4 +1,7 @@
![Tests failed](https://img.shields.io/badge/tests-4207%20passed%2C%202%20failed%2C%2030%20skipped-critical)
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|fixtures/external/jest/jest-test-results.xml|4207:white_check_mark:|2:x:|30:warning:|166s|
## :x: <a id="user-content-r0" href="#r0">fixtures/external/jest/jest-test-results.xml</a>
**4239** tests were completed in **166s** with **4207** passed, **2** failed and **30** skipped.
|Test suite|Passed|Failed|Skipped|Time|

View file

@ -1,4 +1,7 @@
![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%204%20failed%2C%201%20skipped-critical)
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|fixtures/mocha-json.json|1:white_check_mark:|4:x:|1:warning:|12ms|
## :x: <a id="user-content-r0" href="#r0">fixtures/mocha-json.json</a>
**6** tests were completed in **12ms** with **1** passed, **4** failed and **1** skipped.
|Test suite|Passed|Failed|Skipped|Time|

View file

@ -1,4 +1,9 @@
![Tests passed successfully](https://img.shields.io/badge/tests-833%20passed%2C%206%20skipped-success)
<details><summary>Expand for details</summary>
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|fixtures/external/mocha/mocha-test-results.json|833:white_check_mark:||6:warning:|6s|
## :white_check_mark: <a id="user-content-r0" href="#r0">fixtures/external/mocha/mocha-test-results.json</a>
**839** tests were completed in **6s** with **833** passed, **0** failed and **6** skipped.
|Test suite|Passed|Failed|Skipped|Time|
@ -1429,3 +1434,4 @@ lib/utils type() when toString on null or undefined stringifies window
lib/utils uniqueID()
:white_check_mark: should return a non-empty string
```
</details>

View file

@ -1,4 +1,7 @@
![Tests failed](https://img.shields.io/badge/tests-268%20passed%2C%201%20failed-critical)
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|fixtures/external/flutter/provider-test-results.json|268:white_check_mark:|1:x:||0ms|
## :x: <a id="user-content-r0" href="#r0">fixtures/external/flutter/provider-test-results.json</a>
**269** tests were completed in **0ms** with **268** passed, **1** failed and **0** skipped.
|Test suite|Passed|Failed|Skipped|Time|

View file

@ -1,4 +1,7 @@
![Tests failed](https://img.shields.io/badge/tests-1%20failed%2C%201%20skipped-critical)
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|fixtures/external/java/TEST-org.apache.pulsar.AddMissingPatchVersionTest.xml||1:x:|1:warning:|116ms|
## :x: <a id="user-content-r0" href="#r0">fixtures/external/java/TEST-org.apache.pulsar.AddMissingPatchVersionTest.xml</a>
**2** tests were completed in **116ms** with **0** passed, **1** failed and **1** skipped.
|Test suite|Passed|Failed|Skipped|Time|

View file

@ -1,4 +1,7 @@
![Tests failed](https://img.shields.io/badge/tests-793%20passed%2C%201%20failed%2C%2014%20skipped-critical)
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|fixtures/external/java/pulsar-test-report.xml|793:white_check_mark:|1:x:|14:warning:|2127s|
## :x: <a id="user-content-r0" href="#r0">fixtures/external/java/pulsar-test-report.xml</a>
**808** tests were completed in **2127s** with **793** passed, **1** failed and **14** skipped.
|Test suite|Passed|Failed|Skipped|Time|

View file

@ -1,4 +1,9 @@
![Tests passed successfully](https://img.shields.io/badge/tests-67%20passed%2C%2012%20skipped-success)
<details><summary>Expand for details</summary>
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|VanillaCloudStorageClientTest|67:white_check_mark:||12:warning:|1s|
## :white_check_mark: <a id="user-content-r0" href="#r0">VanillaCloudStorageClientTest</a>
**79** tests were completed in **1s** with **67** passed, **0** failed and **12** skipped.
|Test suite|Passed|Failed|Skipped|Time|
@ -134,3 +139,4 @@
:white_check_mark: SerializedXmlDoesNotContainNullProperties
:white_check_mark: SerializedXmlDoesNotContainPlaintextData
```
</details>

10
dist/index.js generated vendored
View file

@ -1595,7 +1595,12 @@ function getBadge(passed, failed, skipped, options) {
}
function getTestRunsReport(testRuns, options) {
const sections = [];
if (testRuns.length > 1 || options.onlySummary) {
const totalFailed = testRuns.reduce((sum, tr) => sum + tr.failed, 0);
if (totalFailed === 0) {
sections.push(`<details><summary>Expand for details</summary>`);
sections.push(` `);
}
if (testRuns.length > 0 || options.onlySummary) {
const tableData = testRuns
.filter(tr => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0)
.map(tr => {
@ -1613,6 +1618,9 @@ function getTestRunsReport(testRuns, options) {
const suitesReports = testRuns.map((tr, i) => getSuitesReport(tr, i, options)).flat();
sections.push(...suitesReports);
}
if (totalFailed === 0) {
sections.push(`</details>`);
}
return sections;
}
function getSuitesReport(tr, runIndex, options) {

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -143,8 +143,13 @@ function getBadge(passed: number, failed: number, skipped: number, options: Repo
function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): string[] {
const sections: string[] = []
const totalFailed = testRuns.reduce((sum, tr) => sum + tr.failed, 0)
if (totalFailed === 0) {
sections.push(`<details><summary>Expand for details</summary>`)
sections.push(` `)
}
if (testRuns.length > 1 || options.onlySummary) {
if (testRuns.length > 0 || options.onlySummary) {
const tableData = testRuns
.filter(tr => tr.passed > 0 || tr.failed > 0 || tr.skipped > 0)
.map(tr => {
@ -168,6 +173,10 @@ function getTestRunsReport(testRuns: TestRunResult[], options: ReportOptions): s
const suitesReports = testRuns.map((tr, i) => getSuitesReport(tr, i, options)).flat()
sections.push(...suitesReports)
}
if (totalFailed === 0) {
sections.push(`</details>`)
}
return sections
}