diff --git a/.eslintignore b/.eslintignore index 3e4b026a81..d5134e407e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ +coverage/ lib/to-iso-string/**/*.js mocha.js diff --git a/.gitignore b/.gitignore index 05fd3db57e..05cc01726e 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ npm-debug.log* .karma/ *.orig .nyc_output/ +coverage/ diff --git a/.nycrc b/.nycrc new file mode 100644 index 0000000000..8848fa90fd --- /dev/null +++ b/.nycrc @@ -0,0 +1,10 @@ +{ + "reporter": [ + "json", + "text-summary" + ], + "exclude": [ + "lib/browser", + "test/**/*" + ] +} diff --git a/.travis.yml b/.travis.yml index a80e4983a6..553966a6fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ matrix: fast_finish: true include: - node_js: '7' - env: TARGET=test-node + env: TARGET=test-node COVERAGE=true - node_js: '6' env: TARGET=test-node - node_js: '5' @@ -42,6 +42,8 @@ before_script: scripts/travis-before-script.sh script: make $TARGET +after_success: "npm run postcoverage && [Test :: Unit]\n" - $(MOCHA) test/acceptance/*.js \ + $(call test_node,unit) test/acceptance/*.js \ --growl \ test/*.js test-integration: @printf "==> [Test :: Integrations]\n" - $(MOCHA) --timeout 5000 \ + $(call test_node,integration) --timeout 5000 \ test/integration/*.js test-compilers: @printf "==> [Test :: Compilers]\n" - $(MOCHA) --compilers coffee:coffee-script/register,foo:./test/compiler/foo \ + $(call test_node,compilers) --compilers coffee:coffee-script/register,foo:./test/compiler/foo \ test/acceptance/test.coffee \ test/acceptance/test.foo test-requires: @printf "==> [Test :: Requires]\n" - $(MOCHA) --compilers coffee:coffee-script/register \ + $(call test_node,requires) --compilers coffee:coffee-script/register \ --require test/acceptance/require/a.js \ --require test/acceptance/require/b.coffee \ --require test/acceptance/require/c.js \ @@ -80,22 +89,22 @@ test-requires: test-bdd: @printf "==> [Test :: BDD]\n" - $(MOCHA) --ui bdd \ + $(call test_node,bdd) --ui bdd \ test/acceptance/interfaces/bdd.spec test-tdd: @printf "==> [Test :: TDD]\n" - $(MOCHA) --ui tdd \ + $(call test_node,tdd) --ui tdd \ test/acceptance/interfaces/tdd.spec test-qunit: @printf "==> [Test :: QUnit]\n" - $(MOCHA) --ui qunit \ + $(call test_node,qunit) --ui qunit \ test/acceptance/interfaces/qunit.spec test-exports: @printf "==> [Test :: Exports]\n" - $(MOCHA) --ui exports \ + $(call test_node,exports) --ui exports \ test/acceptance/interfaces/exports.spec test-glob: @@ -104,49 +113,49 @@ test-glob: test-reporters: @printf "==> [Test :: Reporters]\n" - $(MOCHA) test/reporters/*.js + $(call test_node,reporters) test/reporters/*.js test-only: @printf "==> [Test :: Only]\n" - $(MOCHA) --ui tdd \ + $(call test_node,only-tdd) --ui tdd \ test/acceptance/misc/only/tdd.spec - $(MOCHA) --ui bdd \ + $(call test_node,only-bdd) --ui bdd \ test/acceptance/misc/only/bdd.spec - $(MOCHA) --ui qunit \ + $(call test_node,only-bdd-require) --ui qunit \ test/acceptance/misc/only/bdd-require.spec test-global-only: @printf "==> [Test :: Global Only]\n" - $(MOCHA) --ui tdd \ + $(call test_node,global-only-tdd) --ui tdd \ test/acceptance/misc/only/global/tdd.spec - $(MOCHA) --ui bdd \ + $(call test_node,global-only-bdd) --ui bdd \ test/acceptance/misc/only/global/bdd.spec - $(MOCHA) --ui qunit \ + $(call test_node,global-only-qunit) --ui qunit \ test/acceptance/misc/only/global/qunit.spec test-mocha: @printf "==> [Test :: Mocha]\n" - $(MOCHA) test/mocha + $(call test_node,mocha) test/mocha non-tty: @printf "==> [Test :: Non-TTY]\n" - $(MOCHA) --reporter dot \ + $(call test_node,non-tty-dot) --reporter dot \ test/acceptance/interfaces/bdd.spec 2>&1 > /tmp/dot.out @echo dot: @cat /tmp/dot.out - $(MOCHA) --reporter list \ + $(call test_node,non-tty-list) --reporter list \ test/acceptance/interfaces/bdd.spec 2>&1 > /tmp/list.out @echo list: @cat /tmp/list.out - $(MOCHA) --reporter spec \ + $(call test_node,non-tty-spec) --reporter spec \ test/acceptance/interfaces/bdd.spec 2>&1 > /tmp/spec.out @echo spec: diff --git a/package.json b/package.json index 764c159381..5f2b93ccbd 100644 --- a/package.json +++ b/package.json @@ -299,7 +299,10 @@ "npm": ">= 1.4.x" }, "scripts": { - "test": "make test" + "test": "make test", + "precoverage": "rm -rf coverage", + "coverage": "COVERAGE=true npm run test", + "postcoverage": "istanbul-combine -d coverage -r lcov -r html coverage/reports/*/*.json" }, "dependencies": { "browser-stdout": "1.3.0", @@ -318,12 +321,14 @@ "assert": "^1.4.1", "browserify": "^13.0.0", "coffee-script": "^1.10.0", + "coveralls": "^2.11.15", "eslint": "^3.11.1", "eslint-config-semistandard": "^7.0.0", "eslint-config-standard": "^6.2.1", "eslint-plugin-promise": "^3.4.0", "eslint-plugin-standard": "2.0.1", "expect.js": "^0.3.1", + "istanbul-combine": "^0.3.0", "karma": "^1.1.0", "karma-browserify": "^5.0.5", "karma-chrome-launcher": "^2.0.0", @@ -332,6 +337,7 @@ "karma-phantomjs-launcher": "^1.0.2", "karma-sauce-launcher": "^1.0.0", "karma-spec-reporter": "0.0.26", + "nyc": "^10.0.0", "os-name": "^2.0.1", "phantomjs": "1.9.8", "rimraf": "^2.5.2",