I have a CI running that does mocha test executions in parallel. A test execution creates a coverage report coverage.json
- generated by nyc
. I want to have a final merged report from all of the coverage.json
s in lcov format, but I can't manage to generate one - I always end up having an empty text summary. What I've tried:
nyc report
:nyc report --temp-dir=nyc/coverage_dir --reporter=text --reporter=lcov
gives an empty report and text summary
nyc merge
and then nyc report
nyc merge ./coverage_dir coverage.json
nyc report --report-dir=temp --reporter=text --reporter=lcov
This combination does seem to merge the coverage.jsons files, at least judging from the file size, but the report
step still displays an empty text summary.
nyc 15.1.0
and nyc 14.1.1
-t
flag and --report-dir
options outlined in this answerAll resulting in an empty text summary of the final report.
I solved it in this way.
Copy all the json files in the default folder:
mkdir .nyc_output
cp project_a/coverage/coverage-final.json .nyc_output/project_a.json
cp project_b/coverage/coverage-final.json .nyc_output/project_b.json
Then generate the report:
nyc report --reporter=text --reporter=lcov --report-dir=destination-dir
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.