我有一个 Angular 8 项目,我正在尝试设置一个用户无法提交的情况,除非某些百分比的代码覆盖率通过。
我正在使用 NX Workspace 和 Husky 在提交之前运行 Linting。我想在此之上运行 ng 测试,以及我可以提供数字的覆盖率测试。如果所有三个都通过,则提交代码。
我现在有这个 package.json 文件。我该如何添加?
"scripts": {
"ng": "ng",
"nx": "nx",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "nx workspace-lint && ng lint",
"e2e": "ng e2e",
"affected:apps": "nx affected:apps",
"affected:libs": "nx affected:libs",
"affected:build": "nx affected:build",
"affected:e2e": "nx affected:e2e",
"affected:test": "nx affected:test",
"affected:lint": "nx affected:lint",
"affected:dep-graph": "nx affected:dep-graph",
"affected": "nx affected",
"format": "nx format:write",
"format:write": "nx format:write",
"format:check": "nx format:check",
"update": "ng update @nrwl/workspace",
"update:check": "ng update",
"workspace-schematic": "nx workspace-schematic",
"dep-graph": "nx dep-graph",
"help": "nx help",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"husky": {
"hooks": {
"pre-commit": "npm run affected:lint"
}
},
...