Skip to content

Commit 0c4e165

Browse files
authored
Merge pull request #99 from dorny/dev
Version 1.4.0
2 parents 2c87efa + c74b76e commit 0c4e165

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+28121
-1150
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
- run: npm test
2222

2323
- name: Upload test results
24+
if: success() || failure()
2425
uses: actions/upload-artifact@v2
2526
with:
2627
name: test-results

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v1.4.0
4+
- [Add support for mocha-json](https://github.com/dorny/test-reporter/pull/90)
5+
- [Use full URL to fix navigation from summary to suite details](https://github.com/dorny/test-reporter/pull/89)
6+
- [New report rendering with code blocks instead of tables](https://github.com/dorny/test-reporter/pull/88)
7+
- [Improve test error messages from flutter](https://github.com/dorny/test-reporter/pull/87)
8+
39
## v1.3.1
410
- [Fix: parsing of .NET duration string without milliseconds](https://github.com/dorny/test-reporter/pull/84)
511
- [Fix: dart-json - remove group name from test case names](https://github.com/dorny/test-reporter/pull/85)

README.md

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ This [Github Action](https://github.com/features/actions) displays test results
99
✔️ Provides final `conclusion` and counts of `passed`, `failed` and `skipped` tests as output parameters
1010

1111
**How it looks:**
12-
|![](assets/fluent-validation-report.png)|![](assets/provider-error-summary.png)|![](assets/provider-error-details.png)|![](assets/provider-groups.png)|
12+
|![](assets/fluent-validation-report.png)|![](assets/provider-error-summary.png)|![](assets/provider-error-details.png)|![](assets/mocha-groups.png)|
1313
|:--:|:--:|:--:|:--:|
1414

1515
**Supported languages / frameworks:**
1616
- .NET / [xUnit](https://xunit.net/) / [NUnit](https://nunit.org/) / [MSTest](https://github.com/Microsoft/testfx-docs)
1717
- Dart / [test](https://pub.dev/packages/test)
1818
- Flutter / [test](https://pub.dev/packages/test)
19-
- JavaScript / [JEST](https://jestjs.io/)
2019
- Java / [JUnit](https://junit.org/)
20+
- JavaScript / [JEST](https://jestjs.io/) / [Mocha](https://mochajs.org/)
2121

2222
For more information see [Supported formats](#supported-formats) section.
2323

@@ -54,9 +54,9 @@ jobs:
5454
## Recommended setup for public repositories
5555
5656
Workflows triggered by pull requests from forked repositories are executed with read-only token and therefore can't create check runs.
57-
To workaround this security restriction it's required to use two separate workflows:
58-
1. `CI` runs in the context of PR head branch with read-only token. It executes the tests and uploads test results as build artifact
59-
2. `Test Report` runs in the context of repository main branch with read/write token. It will download test results and create reports
57+
To workaround this security restriction, it's required to use two separate workflows:
58+
1. `CI` runs in the context of the PR head branch with the read-only token. It executes the tests and uploads test results as a build artifact
59+
2. `Test Report` runs in the context of the repository main branch with read/write token. It will download test results and create reports
6060

6161
**PR head branch:** *.github/workflows/ci.yml*
6262
```yaml
@@ -116,7 +116,7 @@ jobs:
116116
117117
# Coma separated list of paths to test results
118118
# Supports wildcards via [fast-glob](https://github.com/mrmlnc/fast-glob)
119-
# All matched result files must be of same format
119+
# All matched result files must be of the same format
120120
path: ''
121121
122122
# Format of test results. Supported options:
@@ -125,6 +125,7 @@ jobs:
125125
# flutter-json
126126
# java-junit
127127
# jest-junit
128+
# mocha-json
128129
reporter: ''
129130
130131
# Limits which test suites are listed:
@@ -142,7 +143,7 @@ jobs:
142143
# Must be less or equal to 50.
143144
max-annotations: '10'
144145
145-
# Set action as failed if test report contain any failed test
146+
# Set action as failed if test report contains any failed test
146147
fail-on-error: 'true'
147148
148149
# Relative path under $GITHUB_WORKSPACE where the repository was checked out.
@@ -224,8 +225,8 @@ Or with (undocumented) CLI argument:
224225

225226

226227
According to documentation `dart_test.yaml` should be at the root of the package, next to the package's pubspec.
227-
On current `stable` and `beta` channels it doesn't work and you have to put `dart_test.yaml` inside your `test` folder.
228-
On `dev` channel it's already fixed.
228+
On current `stable` and `beta` channels it doesn't work, and you have to put `dart_test.yaml` inside your `test` folder.
229+
On `dev` channel, it's already fixed.
229230

230231
For more information see:
231232
- [test package](https://pub.dev/packages/test)
@@ -239,17 +240,17 @@ For more information see:
239240
<summary>java-junit (Experimental)</summary>
240241

241242
Support for [JUnit](https://Junit.org/) XML is experimental - should work but it was not extensively tested.
242-
To have code annotations working properly it's required your directory structure matches package name.
243-
This is due to the fact Java stacktraces doesn't contains full path to the source file.
244-
Some heuristic was necessary to figure out mapping between line in stack trace and actual source file.
243+
To have code annotations working properly, it's required your directory structure matches the package name.
244+
This is due to the fact Java stack traces don't contain a full path to the source file.
245+
Some heuristic was necessary to figure out the mapping between the line in the stack trace and an actual source file.
245246
</details>
246247

247248
<details>
248249
<summary>jest-Junit</summary>
249250

250-
[JEST](https://jestjs.io/) testing framework support requires usage of [jest-Junit](https://github.com/jest-community/jest-Junit) reporter.
251+
[JEST](https://jestjs.io/) testing framework support requires the usage of [jest-Junit](https://github.com/jest-community/jest-Junit) reporter.
251252
It will create test results in Junit XML format which can be then processed by this action.
252-
You can use following example configuration in `package.json`:
253+
You can use the following example configuration in `package.json`:
253254
```json
254255
"scripts": {
255256
"test": "jest --ci --reporters=default --reporters=jest-Junit"
@@ -272,19 +273,38 @@ You can use following example configuration in `package.json`:
272273
Configuration of `uniqueOutputName`, `suiteNameTemplate`, `classNameTemplate`, `titleTemplate` is important for proper visualization of test results.
273274
</details>
274275

276+
<details>
277+
<summary>mocha-json</summary>
278+
279+
[Mocha](https://mochajs.org/) testing framework support requires:
280+
- Mocha version [v7.2.0](https://github.com/mochajs/mocha/releases/tag/v7.2.0) or higher
281+
- Usage of [json](https://mochajs.org/#json) reporter.
282+
283+
You can use the following example configuration in `package.json`:
284+
```json
285+
"scripts": {
286+
"test": "mocha --reporter json > test-results.json"
287+
}
288+
```
289+
290+
Test processing might fail if any of your tests write anything on standard output.
291+
Mocha, unfortunately, doesn't have the option to store `json` output directly to the file, and we have to rely on redirecting its standard output.
292+
There is a work in progress to fix it: [mocha#4607](https://github.com/mochajs/mocha/pull/4607)
293+
</details>
294+
275295
## GitHub limitations
276296

277-
Unfortunately there are some known issues and limitations caused by GitHub API:
297+
Unfortunately, there are some known issues and limitations caused by GitHub API:
278298

279299
- Test report (i.e. Check Run summary) is markdown text. No custom styling or HTML is possible.
280300
- Maximum report size is 65535 bytes. Input parameters `list-suites` and `list-tests` will be automatically adjusted if max size is exceeded.
281-
- Test report can't reference any additional files (e.g. screenshots). You can use `actions/upload-artifact@v2` to upload them and inspect manually.
282-
- Check Runs are created for specific commit SHA. it's not possible to specify under which workflow test report should belong if there are more
283-
workflows running for same SHA. Thanks to this GitHub "feature" it's possible your test report will appear in unexpected place in GitHub UI.
284-
For more information see [#67](https://github.com/dorny/test-reporter/issues/67).
301+
- Test report can't reference any additional files (e.g. screenshots). You can use `actions/upload-artifact@v2` to upload them and inspect them manually.
302+
- Check Runs are created for specific commit SHA. It's not possible to specify under which workflow test report should belong if more
303+
workflows are running for the same SHA. Thanks to this GitHub "feature" it's possible your test report will appear in an unexpected place in GitHub UI.
304+
For more information, see [#67](https://github.com/dorny/test-reporter/issues/67).
285305

286306
## See also
287-
- [paths-filter](https://github.com/dorny/paths-filter) - Conditionally run actions based on files modified by PR, feature branch or pushed commits
307+
- [paths-filter](https://github.com/dorny/paths-filter) - Conditionally run actions based on files modified by PR, feature branch, or pushed commits
288308

289309
## License
290310

__tests__/__outputs__/dart-json.md

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,28 @@
11
![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%204%20failed%2C%201%20skipped-critical)
2-
## <a id="user-content-r0" href="#r0">fixtures/dart-json.json</a>
3-
**6** tests were completed in **3.760s** with **1** passed, **4** failed and **1** skipped.
2+
## ❌ <a id="user-content-r0" href="#r0">fixtures/dart-json.json</a>
3+
**6** tests were completed in **4s** with **1** passed, **4** failed and **1** skipped.
44
|Test suite|Passed|Failed|Skipped|Time|
55
|:---|---:|---:|---:|---:|
66
|[test/main_test.dart](#r0s0)|1✔️|3❌||74ms|
77
|[test/second_test.dart](#r0s1)||1❌|1✖️|51ms|
8-
### <a id="user-content-r0s0" href="#r0s0">test/main_test.dart</a> ❌
9-
**4** tests were completed in **74ms** with **1** passed, **3** failed and **0** skipped.
10-
11-
**Test 1**
12-
|Result|Test|Time|
13-
|:---:|:---|---:|
14-
|✔️|Passing test|36ms|
15-
16-
**Test 1 Test 1.1**
17-
|Result|Test|Time|
18-
|:---:|:---|---:|
19-
||Failing test|20ms|
20-
||Exception in target unit|6ms|
21-
22-
**Test 2**
23-
|Result|Test|Time|
24-
|:---:|:---|---:|
25-
||Exception in test|12ms|
26-
### <a id="user-content-r0s1" href="#r0s1">test/second_test.dart</a> ❌
27-
**2** tests were completed in **51ms** with **0** passed, **1** failed and **1** skipped.
28-
29-
|Result|Test|Time|
30-
|:---:|:---|---:|
31-
||Timeout test|37ms|
32-
|✖️|Skipped test|14ms|
8+
### ❌ <a id="user-content-r0s0" href="#r0s0">test/main_test.dart</a>
9+
```
10+
Test 1
11+
✔️ Passing test
12+
Test 1 Test 1.1
13+
❌ Failing test
14+
Expected: <2>
15+
Actual: <1>
16+
17+
❌ Exception in target unit
18+
Exception: Some error
19+
Test 2
20+
❌ Exception in test
21+
Exception: Some error
22+
```
23+
### ❌ <a id="user-content-r0s1" href="#r0s1">test/second_test.dart</a>
24+
```
25+
❌ Timeout test
26+
TimeoutException after 0:00:00.000001: Test timed out after 0 seconds.
27+
✖️ Skipped test
28+
```
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
![Tests failed](https://img.shields.io/badge/tests-3%20passed%2C%203%20failed%2C%201%20skipped-critical)
2-
## <a id="user-content-r0" href="#r0">fixtures/dotnet-trx.trx</a>
3-
**7** tests were completed in **1.061s** with **3** passed, **3** failed and **1** skipped.
2+
## ❌ <a id="user-content-r0" href="#r0">fixtures/dotnet-trx.trx</a>
3+
**7** tests were completed in **1s** with **3** passed, **3** failed and **1** skipped.
44
|Test suite|Passed|Failed|Skipped|Time|
55
|:---|---:|---:|---:|---:|
66
|[DotnetTests.XUnitTests.CalculatorTests](#r0s0)|3✔️|3❌|1✖️|110ms|
7-
### <a id="user-content-r0s0" href="#r0s0">DotnetTests.XUnitTests.CalculatorTests</a> ❌
8-
**7** tests were completed in **110ms** with **3** passed, **3** failed and **1** skipped.
9-
10-
|Result|Test|Time|
11-
|:---:|:---|---:|
12-
||Exception_In_TargetTest|0ms|
13-
||Exception_In_Test|2ms|
14-
||Failing_Test|3ms|
15-
|✔️|Passing_Test|0ms|
16-
|✔️|Passing_Test_With_Name|0ms|
17-
|✖️|Skipped_Test|1ms|
18-
|✔️|Timeout_Test|102ms|
7+
### ❌ <a id="user-content-r0s0" href="#r0s0">DotnetTests.XUnitTests.CalculatorTests</a>
8+
```
9+
❌ Exception_In_TargetTest
10+
System.DivideByZeroException : Attempted to divide by zero.
11+
❌ Exception_In_Test
12+
System.Exception : Test
13+
❌ Failing_Test
14+
Assert.Equal() Failure
15+
Expected: 3
16+
Actual: 2
17+
✔️ Passing_Test
18+
✔️ Passing_Test_With_Name
19+
✖️ Skipped_Test
20+
✔️ Timeout_Test
21+
```

0 commit comments

Comments
 (0)