Skip to content

Commit

Permalink
[PR feedback] Switch combine coverage script to .sh
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Oct 20, 2021
1 parent 5072463 commit 52b1244
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"test-staged": "yarn lint && node scripts/test-staged.js",
"test-cypress": "cross-env NODE_ENV=cypress_test cypress run-ct",
"test-cypress-dev": "cross-env NODE_ENV=cypress_test cypress open-ct",
"combine-test-coverage": "node ./scripts/combine-coverage.js",
"combine-test-coverage": "sh ./scripts/combine-coverage.sh",
"start-test-server": "BABEL_MODULES=false NODE_ENV=puppeteer NODE_OPTIONS=--max-old-space-size=4096 webpack-dev-server --config src-docs/webpack.config.js --port 9999",
"yo-component": "yo ./generator-eui/app/component.js",
"update-token-changelog": "node ./scripts/update-token-changelog.js",
Expand Down
25 changes: 0 additions & 25 deletions scripts/combine-coverage.js

This file was deleted.

17 changes: 17 additions & 0 deletions scripts/combine-coverage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

# Combines Jest code coverage and Cypress code coverage into a single report %
# NOTE: `yarn test-cypress` and `yarn test-unit --coverage` must have already been run
# in order for the correct coverage JSON files to exist and be combined

# Clean folder and re-import Jest/Cypress JSON coverage reports
rm -rf reports/combined-coverage && mkdir reports/combined-coverage
cp reports/jest-coverage/coverage-final.json reports/combined-coverage/jest-coverage.json
cp reports/cypress-coverage/coverage-final.json reports/combined-coverage/cypress-coverage.json

# Tell Istanbul to merge the reports in the folder and generate a HTML report
yarn nyc merge reports/combined-coverage reports/combined-coverage/coverage-final.json
yarn nyc report --reporter html --temp-dir reports/combined-coverage --report-dir reports/combined-coverage

# Open the HTML report for convenience
open reports/combined-coverage/index.html

0 comments on commit 52b1244

Please sign in to comment.