mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-15 22:07:09 +01:00
Update mocha-json usage instructions
This commit is contained in:
parent
0d00bb14cb
commit
ceb9822f8b
1 changed files with 11 additions and 5 deletions
16
README.md
16
README.md
|
|
@ -290,16 +290,22 @@ Configuration of `uniqueOutputName`, `suiteNameTemplate`, `classNameTemplate`, `
|
||||||
- Mocha version [v7.2.0](https://github.com/mochajs/mocha/releases/tag/v7.2.0) or higher
|
- Mocha version [v7.2.0](https://github.com/mochajs/mocha/releases/tag/v7.2.0) or higher
|
||||||
- Usage of [json](https://mochajs.org/#json) reporter.
|
- Usage of [json](https://mochajs.org/#json) reporter.
|
||||||
|
|
||||||
You can use the following example configuration in `package.json`:
|
For Mocha >= [v9.1.0](https://github.com/mochajs/mocha/releases/tag/v9.1.0), you can use the following example configuration in `package.json`:
|
||||||
|
```json
|
||||||
|
"scripts": {
|
||||||
|
"test": "mocha --reporter json --reporter-option output=test-results.json"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For Mocha < v9.1, the command should look like this:
|
||||||
```json
|
```json
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha --reporter json > test-results.json"
|
"test": "mocha --reporter json > test-results.json"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Additionally, test processing might fail if any of your tests write anything on standard output.
|
||||||
Test processing might fail if any of your tests write anything on standard output.
|
Before version [v9.1.0](https://github.com/mochajs/mocha/releases/tag/v9.1.0), Mocha doesn't have the option to store `json` output directly to the file, and we have to rely on redirecting its standard output ([mocha#4607](https://github.com/mochajs/mocha/pull/4607)).
|
||||||
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.
|
Please update Mocha to version [v9.1.0](https://github.com/mochajs/mocha/releases/tag/v9.1.0) or above if you encounter this issue.
|
||||||
There is a work in progress to fix it: [mocha#4607](https://github.com/mochajs/mocha/pull/4607)
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
## GitHub limitations
|
## GitHub limitations
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue