-
Notifications
You must be signed in to change notification settings - Fork 150
chore: enforce 100% coverage on CI #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
module.exports = { | ||
testMatch: ['**/tests/**/*.js'], | ||
coverageThreshold: { | ||
global: { | ||
branches: 100, | ||
functions: 100, | ||
lines: 100, | ||
statements: 100, | ||
}, | ||
}, | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,9 @@ | |
"lint": "eslint ./", | ||
"lint:fix": "npm run lint -- --fix", | ||
"format": "prettier --write README.md {lib,docs,tests}/**/*.{js,md}", | ||
"test": "jest", | ||
"test:local": "jest", | ||
"test:ci": "jest --coverage", | ||
"test": "is-ci test:ci test:local", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious as to why not simply running There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mmm it's interesting: on one hand doesn't seem like a necessary dependency as you mentioned, but on the other hand it simplifies the execution of tests and external scripts to just There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I'm not mistaken, the default Travis CI configuration for Node.js includes a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why have these 2 seperated? if you want to run w/out coverage you can do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's fine, was just curious if there was some other reason 🙂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @benmonro I usually prefer having 2 different tests scripts for local and ci just in case there are more things to set up for each (there is another project where I had to set some specific env vars and junit reporter), so it's easier to maintain in that way I think. And even better: it's transparent from executing the script with the package that Thomas added :) |
||
"semantic-release": "semantic-release" | ||
}, | ||
"dependencies": {}, | ||
|
@@ -46,6 +48,7 @@ | |
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-standard": "^4.0.1", | ||
"husky": "^3.0.5", | ||
"is-ci-cli": "^2.0.0", | ||
"jest": "^24.9.0", | ||
"lint-staged": "^9.2.5", | ||
"prettier": "1.18.2", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't know that this already prevents CI from continuing as it makes jest fails if threshold is not met!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jest is awesome for that. Just set a coverage threshold and you're good to go as long as you run
jest --coverage
!