I've inherited a JS code base with Jasmine unit tests. The testing framework uses karma
and instanbul-combine
to get code coverage. It seems istanbul-combine
isn't working with present node modules, and besides is no longer maintained: the recommended replacement is nyc
. I'm having trouble replacing istanbul-combine
with nyc
in the Makefile
.
Here's are my attempts at merging the data (not even trying to get a report yet):
#1
@for dir in $(shell ls -d coverage/*/); do \
echo "Merging $${dir}"; \
npx nyc merge $${dir} coverage-final.json; \
done
#2
npx nyc merge coverage coverage-final.json
#3
npx nyc merge --include coverage/*/ coverage-final.json
The coverage data is in coverage/*/coverage-final.json
, but none of these attempts succeeds in mergeing it into the result file coverage-final.json
.
With #1, I'm pretty sure it's only actually merging a single set of results into the result file. With #2, there's an error; but if I put that command in the shell CLI, nothing is put into the result file.
With #3, at least there's no error, but only one of the coverage files is merged.
Here's the original Makefile line that I'm replacing:
PATH=$(PROJECT_HOME)/bin:$$PATH node_modules/istanbul-combine/cli.js \
-d coverage/summary -r html \
coverage/*/coverage-final.json