diff --git a/.istanbul.yml b/.istanbul.yml index 7178a27ceb..5830ddb662 100644 --- a/.istanbul.yml +++ b/.istanbul.yml @@ -1,2 +1,3 @@ instrumentation: - root: lib + root: . + excludes: "**/node_modules/**" diff --git a/Makefile b/Makefile index 39032e44f3..630ee35f37 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ test-browser: test-cov: clean BABEL_ENV=test; \ make build - node $(ISTANBUL_CMD) $(MOCHA_CMD) -- test/core + ./scripts/test-cov.sh test-travis: bootstrap lint build test diff --git a/mocha.opts b/mocha.opts new file mode 100644 index 0000000000..300bd66961 --- /dev/null +++ b/mocha.opts @@ -0,0 +1 @@ +--reporter dot --ui tdd diff --git a/scripts/_get-test-directories.sh b/scripts/_get-test-directories.sh new file mode 100755 index 0000000000..a10453a9bd --- /dev/null +++ b/scripts/_get-test-directories.sh @@ -0,0 +1,16 @@ +#!/bin/sh +set -e + +TEST_DIRS="" + +for f in packages/*; do + if [ -n "$TEST_ONLY" ] && [ `basename $f` != "$TEST_ONLY" ]; then + continue + fi + + if [ -d "$f/test" ]; then + TEST_DIRS="$f/test $TEST_DIRS" + fi +done + +echo $TEST_DIRS diff --git a/scripts/test-cov.sh b/scripts/test-cov.sh new file mode 100755 index 0000000000..f194787bad --- /dev/null +++ b/scripts/test-cov.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -e + +node node_modules/istanbul/lib/cli.js cover node_modules/mocha/bin/_mocha -- `scripts/_get-test-directories.sh` --opts mocha.opts +test -n "`which open`" && open coverage/lcov-report/index.html diff --git a/scripts/test.sh b/scripts/test.sh index c834f745e9..0acc03d650 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -5,16 +5,4 @@ if [ -z "$TEST_GREP" ]; then TEST_GREP="" fi -TEST_DIRS="" - -for f in packages/*; do - if [ -n "$TEST_ONLY" ] && [ `basename $f` != "$TEST_ONLY" ]; then - continue - fi - - if [ -d "$f/test" ]; then - TEST_DIRS="$f/test $TEST_DIRS" - fi -done - -node node_modules/mocha/bin/_mocha $TEST_DIRS --reporter dot --ui tdd --grep "$TEST_GREP" +node node_modules/mocha/bin/_mocha `scripts/_get-test-directories.sh` --opts mocha.opts --grep "$TEST_GREP"