canvas-lms/script/generate_js_coverage

26 lines
885 B
Bash
Executable File

#!/bin/bash
set -e
###
# This script does the work of combining various coverage JS code coverage files
# together to produce one common html (and json) coverage report for the entire
# repository, including the packages we've separated out in our packages/ directory.
#
#
###
export COVERAGE=true
if [ "$RUN_TESTS_FIRST" ]; then
echo '========== Running tests with coverage ==========='
yarn test
fi
echo '========== Merging all coverage reports =========='
./node_modules/.bin/istanbul-merge --out .nyc_output/total-coverage.json "{coverage-karma,coverage-jest,packages/*/coverage}/**/coverage*.json"
echo '============= Generating HTML Report ============='
./node_modules/.bin/nyc report --reporter=html --report-dir coverage-js
echo '============= Generating JSON Summary ============='
./node_modules/.bin/nyc report --reporter=json-summary --report-dir coverage-js