Add unit test coverage report for C++

This commit is contained in:
Lovell Fuller 2017-11-30 20:16:30 +00:00
parent ef06d560cd
commit 50848ee462
3 changed files with 10 additions and 3 deletions

2
.gitignore vendored
View File

@ -1,6 +1,6 @@
build build
node_modules node_modules
coverage /coverage
test/bench/node_modules test/bench/node_modules
test/fixtures/output* test/fixtures/output*
test/leak/libvips.supp test/leak/libvips.supp

View File

@ -45,6 +45,7 @@
"scripts": { "scripts": {
"clean": "rm -rf node_modules/ build/ vendor/ coverage/ test/fixtures/output.*", "clean": "rm -rf node_modules/ build/ vendor/ coverage/ test/fixtures/output.*",
"test": "semistandard && cc && nyc --reporter=lcov --branches=99 mocha --slow=5000 --timeout=60000 ./test/unit/*.js", "test": "semistandard && cc && nyc --reporter=lcov --branches=99 mocha --slow=5000 --timeout=60000 ./test/unit/*.js",
"coverage": "./test/coverage/report.sh",
"test-leak": "./test/leak/leak.sh", "test-leak": "./test/leak/leak.sh",
"docs": "for m in constructor input resize composite operation colour channel output utility; do documentation build --shallow --format=md lib/$m.js >docs/api-$m.md; done" "docs": "for m in constructor input resize composite operation colour channel output utility; do documentation build --shallow --format=md lib/$m.js >docs/api-$m.md; done"
}, },
@ -74,7 +75,7 @@
"nan": "^2.8.0", "nan": "^2.8.0",
"semver": "^5.4.1", "semver": "^5.4.1",
"simple-get": "^2.7.0", "simple-get": "^2.7.0",
"tar": "^4.0.1", "tar": "^4.1.1",
"tunnel-agent": "^0.6.0" "tunnel-agent": "^0.6.0"
}, },
"devDependencies": { "devDependencies": {
@ -84,7 +85,7 @@
"exif-reader": "^1.0.2", "exif-reader": "^1.0.2",
"icc": "^1.0.0", "icc": "^1.0.0",
"mocha": "^4.0.1", "mocha": "^4.0.1",
"nyc": "^11.3.0", "nyc": "^11.4.0",
"rimraf": "^2.6.1", "rimraf": "^2.6.1",
"semistandard": "^11.0.0", "semistandard": "^11.0.0",
"unzip": "^0.1.11" "unzip": "^0.1.11"

6
test/coverage/report.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
CPPFLAGS="--coverage" LDFLAGS="--coverage" npm rebuild
npm test
geninfo --no-external --base-directory src --output-file coverage/sharp.info build/Release/obj.target/sharp/src
genhtml --title sharp --demangle-cpp --output-directory coverage/sharp coverage/*.info