使用 husky 强制代码提交前必须通过测试

This commit is contained in:
modood
2017-05-31 16:46:34 +08:00
parent 43999f64a3
commit cc78047f36
2 changed files with 18 additions and 10 deletions

View File

@@ -2,14 +2,14 @@ module.exports = {
root: true,
extends: 'standard',
globals: {
'describe': true,
'it': true,
'before': true,
'beforeEach': true,
'after': true,
'afterEach': true,
'context': true,
'expect': true
// mocha BDD
describe: true,
context: true,
it: true,
specify: true,
before: true,
beforeEach: true,
after: true,
afterEach: true
}
}

View File

@@ -4,7 +4,8 @@
"description": "中华人民共和国行政区划:省份、城市、区县、乡镇(街道)",
"main": "index.js",
"scripts": {
"test": "mocha -t 5000"
"test": "eslint . && mocha -t 5000",
"precommit": "npm test"
},
"repository": {
"type": "git",
@@ -33,6 +34,13 @@
"iconv-lite": "^0.4.15"
},
"devDependencies": {
"eslint": "^3.19.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "^2.3.0",
"eslint-plugin-node": "^4.2.2",
"eslint-plugin-promise": "^3.5.0",
"eslint-plugin-standard": "^3.0.1",
"husky": "^0.13.4",
"mocha": "^3.1.0"
},
"license": "MIT",