Skip to content

Commit

Permalink
ci(test coverage): add nyc and cross-env to include test coverage
Browse files Browse the repository at this point in the history
BREAKING CHANGE: need to install nyc, cross-env and babel-plugin-istanbul plugins
  • Loading branch information
Jun711 committed Feb 27, 2018
1 parent b6715f7 commit 2d14725
Show file tree
Hide file tree
Showing 4 changed files with 320 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"presets": ["env"],
"env":{
"test":{
"presets":["env"]
"plugins": ["istanbul"]
}
}
}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
.idea/
node_modules/
*.log

# build
build/

# code coverage
.nyc_output
coverage/
23 changes: 22 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "It is to locate the location of a user",
"main": "src/index.js",
"scripts": {
"test": "NODE_ENV=test ./node_modules/.bin/mocha --require babel-register --require isomorphic-fetch --require babel-polyfill tests/*.js --reporter spec||exit 0",
"test": "cross-env NODE_ENV=test nyc --require babel-register --require isomorphic-fetch --require babel-polyfill --reporter=lcov --reporter=text mocha ./tests/*.js",
"clean": "rm -rf build",
"prepublish": "npm test",
"commit": "git-cz",
Expand Down Expand Up @@ -33,18 +33,21 @@
"babel-core": "^6.26.0",
"babel-eslint": "^8.2.1",
"babel-loader": "^7.1.2",
"babel-plugin-istanbul": "^4.1.5",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-register": "^6.26.0",
"chai": "^4.1.2",
"commitizen": "^2.9.6",
"cross-env": "^5.1.3",
"cz-conventional-changelog": "^2.1.0",
"eslint": "^4.17.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.8.0",
"fetch-mock": "^6.0.0",
"isomorphic-fetch": "^2.2.1",
"mocha": "^5.0.0",
"nyc": "10",
"sinon": "^4.3.0",
"webpack": "^3.11.0",
"webpack-dev-server": "^2.11.1"
Expand All @@ -54,6 +57,24 @@
"path": "./node_modules/cz-conventional-changelog"
}
},
"nyc": {
"check-coverage": true,
"per-file": true,
"lines": 99,
"statements": 99,
"functions": 99,
"branches": 99,
"include": [
"src/**/*.js"
],
"require": [
"babel-register",
"isomorphic-fetch",
"babel-polyfill"
],
"sourceMap": false,
"instrument": false
},
"dependencies": {
"geo-amazon": "^0.2.0"
}
Expand Down
Loading

0 comments on commit 2d14725

Please sign in to comment.