Skip to content

Commit

Permalink
🐛 fix so coverage is only generated for node v6
Browse files Browse the repository at this point in the history
  • Loading branch information
philschatz committed Dec 29, 2016
1 parent 03e182f commit ee1718a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -14,4 +14,4 @@ before_script:

after_success:
# Report coverage to codecov
- npm run-script send-coverage
- ./script/send-coverage.sh
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -10,7 +10,6 @@
"test": "npm run-script test-node && npm run-script test-browser",
"pretest-node": "babel --source-maps true --source-root ./index.js ./test/ -d ./test-transpiled/",
"test-node": "VCR_MODE=cache istanbul cover _mocha -- --reporter spec ./test-transpiled/**/node**.js",
"posttest-node": "remap-istanbul --exclude 'index.js' --input ./coverage/coverage.json --output ./coverage/lcov-report-mapped/ --type html && remap-istanbul --exclude 'index.js' --input ./coverage/coverage.json --output ./coverage/coverage.json --type json",
"pretest-browser": "webpack --config webpack.config-browsertests.js",
"test-browser": "./script/run-test-browser.sh",
"test-browser-only": "mocha-phantomjs --reporter spec --timeout 20000 http://localhost:9876/test/index.html",
Expand Down
14 changes: 14 additions & 0 deletions script/send-coverage.sh
@@ -0,0 +1,14 @@
#!/bin/bash

nodeVer=$(node --version)
semver=( ${nodeVer//./ } )

if [[ "${semver[0]}" == "v6" ]]; then

echo "==> Reporting coverage to codecov"
$(npm bin)/remap-istanbul --exclude 'index.js' --input ./coverage/coverage.json --output ./coverage/coverage-mapped-to-source.json --type json
$(npm bin)/codecov --file ./coverage/coverage-mapped-to-source.json

else
echo "==> Skipping coverage reporting because remap-istanbul only works on node v6+"
fi

0 comments on commit ee1718a

Please sign in to comment.