From 6cb023590a5889cf6bf62846246496af74b506b2 Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Wed, 9 Nov 2016 18:24:57 +0200 Subject: [PATCH] Count Babel tests towards Babylon code coverage (#182) * Add code coverage from Babel tests * Configure nyc correctly for Babel test coverage * Guard against nyc config conflicts if Babel switches to nyc in the future * Move .nyc_output from Babel build dir to root --- .travis.yml | 2 +- Makefile | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index da0057b7a0..8ec6ff48d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,7 +35,7 @@ matrix: - node_js: "node" env: BABEL=true -after_success: 'if [ -z "${LINT-}" ] && [ -z "${FLOW-}" ] && [ -z "${BABEL-}" ]; then npm run coverage ; fi' +after_success: 'if [ -z "${LINT-}" ] && [ -z "${FLOW-}" ]; then npm run coverage ; fi' notifications: slack: babeljs:5Wy4QX13KVkGy9CnU0rmvgeK diff --git a/Makefile b/Makefile index facab46e55..a34e1fa2b4 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,10 @@ bootstrap-babel: clean find ./build/babel/packages -type d -name 'babylon' -prune -exec rm -rf '{}' \; -exec ln -s '../../../../../' '{}' \; test-babel: - npm run build + BABEL_ENV=test npm run build + # in case babel ever switches to nyc: filter its config out of package.json cd ./build/babel; \ - make test-only - + jq "del(.nyc)" package.json > package.nonyc.json; \ + mv -f package.nonyc.json package.json; \ + ../../node_modules/.bin/nyc --no-instrument --no-source-map --report-dir ../../coverage node_modules/mocha/bin/_mocha `scripts/_get-test-directories.sh` --opts test/mocha.opts; \ + mv .nyc_output ../../.nyc_output