New report rendering with code blocks instead of tables

Previously we listed tests using markdown tables. Each test group had it's own table and textual preface saying how many tests were executed in what time.
This was completely reworked - now tests are listed inside code block. Grouping is achieved using simple indentation. Duration of individual tests is no longer shown - it produced too much "noise" in the report. Pass/Fail check-mark was also moved before name of test suite.
Behavior of "listTests" option was also changed - now if set to failed, it will list all tests, but only if suite is failed. Otherwise test listing is completely omitted.
Last change affects report trimming - if report is still too big after "listTests" is set to "failed" - it will trim report to fit max size and add informational message at the end.
This commit is contained in:
Michal Dorner 2021-03-31 21:49:53 +02:00
parent 96df6db61e
commit 690ec77880
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
13 changed files with 3292 additions and 1046 deletions

View file

@ -1,32 +1,26 @@
![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%204%20failed%2C%201%20skipped-critical)
## <a id="user-content-r0" href="#r0">fixtures/jest-junit.xml</a>
**6** tests were completed in **1.360s** with **1** passed, **4** failed and **1** skipped.
## <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|
|:---|---:|---:|---:|---:|
|[__tests__\main.test.js](#r0s0)|1✔|3❌||486ms|
|[__tests__\second.test.js](#r0s1)||1❌|1✖|82ms|
### <a id="user-content-r0s0" href="#r0s0">__tests__\main.test.js</a>
**4** tests were completed in **486ms** with **1** passed, **3** failed and **0** skipped.
**Test 1**
|Result|Test|Time|
|:---:|:---|---:|
|✔️|Passing test|1ms|
**Test 1 Test 1.1**
|Result|Test|Time|
|:---:|:---|---:|
|❌|Failing test|2ms|
|❌|Exception in target unit|0ms|
**Test 2**
|Result|Test|Time|
|:---:|:---|---:|
|❌|Exception in test|0ms|
### <a id="user-content-r0s1" href="#r0s1">__tests__\second.test.js</a>
**2** tests were completed in **82ms** with **0** passed, **1** failed and **1** skipped.
|Result|Test|Time|
|:---:|:---|---:|
|❌|Timeout test|4ms|
|✖️|Skipped test|0ms|
### ❌ <a id="user-content-r0s0" href="#r0s0">__tests__\main.test.js</a>
```
Test 1
✔️ Passing test
Test 1 Test 1.1
❌ Failing test
Error: expect(received).toBeTruthy()
❌ Exception in target unit
Error: Some error
Test 2
❌ Exception in test
Error: Some error
```
### ❌ <a id="user-content-r0s1" href="#r0s1">__tests__\second.test.js</a>
```
❌ Timeout test
: Timeout - Async callback was not invoked within the 1 ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 1 ms timeout specified by jest.setTimeout.Error:
✖️ Skipped test
```