From 36cff7c6aeb032c058a28d4e97de42b48d6e78d1 Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Sat, 15 Oct 2016 18:05:11 +0300 Subject: [PATCH 1/4] Add code coverage from Babel tests --- .travis.yml | 2 +- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 78fb6a1ad1..eef379404c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,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..71fbbae847 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ 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 cd ./build/babel; \ - make test-only + ../../node_modules/.bin/nyc --report-dir ../../coverage node_modules/mocha/bin/_mocha `scripts/_get-test-directories.sh` --opts test/mocha.opts; From 5a68bef8c32f12f37be49a194c67cbe6b4d59da1 Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Sat, 15 Oct 2016 18:24:09 +0300 Subject: [PATCH 2/4] Configure nyc correctly for Babel test coverage --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 71fbbae847..a810652cf2 100644 --- a/Makefile +++ b/Makefile @@ -16,5 +16,5 @@ bootstrap-babel: clean test-babel: BABEL_ENV=test npm run build cd ./build/babel; \ - ../../node_modules/.bin/nyc --report-dir ../../coverage node_modules/mocha/bin/_mocha `scripts/_get-test-directories.sh` --opts test/mocha.opts; + ../../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 From 8980c6ea72461d27b1b0f4d613178f21c2c8d168 Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Sat, 15 Oct 2016 18:37:30 +0300 Subject: [PATCH 3/4] Guard against nyc config conflicts if Babel switches to nyc in the future --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a810652cf2..f9010631d8 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,8 @@ bootstrap-babel: clean test-babel: BABEL_ENV=test npm run build + # in case babel ever switches to nyc: filter its config out of package.json cd ./build/babel; \ + 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 - From 3c643651134713f4f91ae317766d2ba8820a9a1b Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Sat, 15 Oct 2016 18:40:35 +0300 Subject: [PATCH 4/4] Move .nyc_output from Babel build dir to root --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f9010631d8..a34e1fa2b4 100644 --- a/Makefile +++ b/Makefile @@ -19,4 +19,5 @@ test-babel: cd ./build/babel; \ 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 + ../../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