'Reporting Jest Test run result in a file
I am new to Jest. I am able to set it up and write my Jest tests and execute from the package.json by specifying another target like this in a Node-16.x environment.
"test": "jest -config=jest.config.json"
"test-cov": "jest -config=jest.config.json --coverage"
Now what I want is that: I want to save the run reports in a file -- which I will later on share over email to notify the report.
In effect, what I am looking for are:
- In case I am running without
--coverage- how can I save the PASS/FAIL report in a file in a specified location (like report_dir/report_service.) - In case I am running with
--coverage- how can I save the PASS/FAIL report in a file in a specified location (like report_dir/report__coverage_service.)
Solution 1:[1]
The jest configuration one can specify the reports. Even including custom reports also.
The options can be checked Jest Reporting and Jest Coverage Reporting
All the Jest config options can be found here: Configuring Jest
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Pradip |
