Add test coverage + clean up build scripts

exif-summary
Romain 7 years ago
parent 3e098e2328
commit e9e5f32970

1
.gitignore vendored

@ -1,4 +1,5 @@
node_modules
coverage
test-snapshot/output-actual
test-snapshot/output-expected/public
test-snapshot/output-expected/metadata.json

9698
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -24,8 +24,8 @@
},
"scripts": {
"lint": "standard && require-lint --ignore-extra lightgallery --ignore-extra video.js",
"unit": "mocha",
"test": "npm run lint && mocha"
"unit": "istanbul cover node_modules/mocha/bin/_mocha",
"test": "npm run lint && npm run unit"
},
"dependencies": {
"async": "^2.5.0",
@ -53,7 +53,9 @@
"zen-observable": "^0.6.0"
},
"devDependencies": {
"gm": "^1.23.0",
"injectmd": "^1.0.0",
"istanbul": "^0.4.5",
"markdown-toc": "^1.1.0",
"mocha": "^4.0.1",
"mock-fs": "^4.4.2",

@ -3,16 +3,24 @@
# Fail the build on any error
set -eou pipefail
echo "--- Run unit tests"
trap failure ERR
function failure {
echo ""
echo "=================================="
echo " ✘ Build failed"
echo "=================================="
}
echo "Run unit tests"
npm test
echo "--- Verify lightgallery dependency is built in"
echo "Verify lightgallery dependency is built in"
grep \"lightgallery\" package.json 1>/dev/null
echo "--- Comparing gallery snapshot"
echo "Comparing gallery snapshot"
scripts/verify
echo ""
echo "================"
echo "Build successful"
echo "================"
echo "=================================="
echo "Build successful"
echo "=================================="

@ -21,6 +21,8 @@ for expected in output-expected/*.html; do
diff -ub "${expected}" "${actual}"
done
echo "HTML pages are identical to snapshot"
# compare media with the snapshot
IFS=$'\n'; set -f
for expected in $(find output-expected/media -name "*.jpg"); do
@ -29,4 +31,4 @@ for expected in $(find output-expected/media -name "*.jpg"); do
done
unset IFS; set +f
echo "Output is identical to snapshot"
echo "Resized media is identical to snapshot"

Loading…
Cancel
Save