diff --git a/.babelrc b/.babelrc index 735385d1b..67435a531 100644 --- a/.babelrc +++ b/.babelrc @@ -1,5 +1,5 @@ { - plugins: [ + "plugins": [ "transform-decorators-legacy", ["transform-es2015-template-literals", { "loose": true }], "transform-es2015-literals", @@ -22,5 +22,10 @@ "transform-object-rest-spread", "transform-react-jsx", "syntax-jsx" - ] + ], + "env": { + "test": { + "plugins": ["istanbul"] + } + } } diff --git a/.gitignore b/.gitignore index dbb9d4c83..f53a08f0e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ npm-debug.log .DS_Store dist lib +.nyc_output coverage diff --git a/.travis.yml b/.travis.yml index fdcb9167e..31bd8886a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,6 @@ node_js: - "5" script: - npm run lint - - npm test + - npm run test:cov +after_success: + - npm run coverage diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..69cb76019 --- /dev/null +++ b/codecov.yml @@ -0,0 +1 @@ +comment: false diff --git a/package.json b/package.json index 52b9219b8..55c5c4c91 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,10 @@ "clean": "rimraf lib dist coverage", "lint": "eslint src test", "prepublish": "npm run clean && npm run build", - "test": "mocha --compilers js:babel-register --recursive --require ./test/setup.js", + "test": "cross-env NODE_ENV=test mocha --compilers js:babel-register --recursive --require ./test/setup.js", "test:watch": "npm test -- --watch", - "test:cov": "babel-node ./node_modules/isparta/bin/isparta cover ./node_modules/mocha/bin/_mocha -- --recursive" + "test:cov": "cross-env NODE_ENV=test nyc npm test", + "coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov" }, "repository": { "type": "git", @@ -47,6 +48,7 @@ "babel-eslint": "^6.1.2", "babel-loader": "^6.2.0", "babel-plugin-check-es2015-constants": "^6.3.13", + "babel-plugin-istanbul": "^2.0.0", "babel-plugin-syntax-jsx": "^6.3.13", "babel-plugin-transform-decorators-legacy": "^1.2.0", "babel-plugin-transform-es2015-arrow-functions": "^6.3.13", @@ -70,6 +72,7 @@ "babel-plugin-transform-react-display-name": "^6.4.0", "babel-plugin-transform-react-jsx": "^6.4.0", "babel-register": "^6.3.13", + "codecov": "^1.0.1", "cross-env": "^1.0.7", "es3ify": "^0.2.0", "eslint": "^3.3.1", @@ -77,10 +80,10 @@ "eslint-plugin-react": "^6.1.1", "expect": "^1.8.0", "glob": "^6.0.4", - "isparta": "4.0.0", - "istanbul": "^0.3.17", + "istanbul": "^0.4.4", "jsdom": "~5.4.3", "mocha": "^2.2.5", + "nyc": "^8.1.0", "react": "^0.14.0", "react-addons-test-utils": "^0.14.0", "react-dom": "^0.14.0", @@ -102,5 +105,9 @@ "transform": [ "loose-envify" ] + }, + "nyc": { + "sourceMap": false, + "instrument": false } }