Skip to content

Commit

Permalink
Fix edge case of one test assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
Ray Xu authored and Zach Renner committed Jan 4, 2023
1 parent 3608ee0 commit 724497a
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 6 deletions.
3 changes: 3 additions & 0 deletions __tests__/__outputs__/dart-json.md
Original file line number Diff line number Diff line change
@@ -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|
Expand Down
3 changes: 3 additions & 0 deletions __tests__/__outputs__/dotnet-trx.md
Original file line number Diff line number Diff line change
@@ -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|
Expand Down
8 changes: 7 additions & 1 deletion __tests__/__outputs__/fluent-validation-test-results.md
Original file line number Diff line number Diff line change
@@ -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|
Expand Down Expand Up @@ -1054,4 +1059,5 @@
:white_check_mark: Unexpected_message_check(withoutErrMsg: "bar", errMessages: [])
:white_check_mark: Unexpected_severity_check
:white_check_mark: Unexpected_state_check
```
```
</details>
3 changes: 3 additions & 0 deletions __tests__/__outputs__/jest-junit.md
Original file line number Diff line number Diff line change
@@ -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|
Expand Down
3 changes: 3 additions & 0 deletions __tests__/__outputs__/jest-test-results.md
Original file line number Diff line number Diff line change
@@ -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|
Expand Down
3 changes: 3 additions & 0 deletions __tests__/__outputs__/mocha-json.md
Original file line number Diff line number Diff line change
@@ -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|
Expand Down
8 changes: 7 additions & 1 deletion __tests__/__outputs__/mocha-test-results.md
Original file line number Diff line number Diff line change
@@ -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|
Expand Down Expand Up @@ -1428,4 +1433,5 @@ lib/utils type() when toString on null or undefined stringifies window
:white_check_mark: should recognize null and undefined
lib/utils uniqueID()
:white_check_mark: should return a non-empty string
```
```
</details>
3 changes: 3 additions & 0 deletions __tests__/__outputs__/provider-test-results.md
Original file line number Diff line number Diff line change
@@ -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|
Expand Down
3 changes: 3 additions & 0 deletions __tests__/__outputs__/pulsar-test-results-no-merge.md
Original file line number Diff line number Diff line change
@@ -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|
Expand Down
3 changes: 3 additions & 0 deletions __tests__/__outputs__/pulsar-test-results.md
Original file line number Diff line number Diff line change
@@ -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|
Expand Down
8 changes: 7 additions & 1 deletion __tests__/__outputs__/silent-notes-test-results.md
Original file line number Diff line number Diff line change
@@ -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|
Expand Down Expand Up @@ -133,4 +138,5 @@
:white_check_mark: SerializedXmlCanBeReadBack
:white_check_mark: SerializedXmlDoesNotContainNullProperties
:white_check_mark: SerializedXmlDoesNotContainPlaintextData
```
```
</details>
10 changes: 9 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion src/report/get-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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
}

Expand Down

0 comments on commit 724497a

Please sign in to comment.