-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Add combined coverage threshold for directories #4885
Add combined coverage threshold for directories #4885
Conversation
Add unit test for passing directory coverage Add test for when there is no coverage data available Fix type errors and make code more familiar Run prettier on changed files
68a798d
to
ab1d9fa
Compare
Codecov Report
@@ Coverage Diff @@
## master #4885 +/- ##
==========================================
+ Coverage 59.75% 59.95% +0.19%
==========================================
Files 195 195
Lines 6533 6562 +29
Branches 4 4
==========================================
+ Hits 3904 3934 +30
+ Misses 2629 2628 -1
Continue to review full report at Codecov.
|
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.
Looking good! Can you update the docs and changelog as well?
Thanks for the review @SimenB. I've updated the changelog and docs. Let me know if you spot any areas that could be improved. |
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.
LGTM, but this is a part of the code base I haven't touched, so should have another set of eyes
this is part of my config, then I encountered |
Itæs not released yet - use |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Right now you can specify a global threshold in Jest and a threshold for files that match a glob pattern. But you can't specify a threshold for a given directory. This pull request adds that functionality without taking away any functionality from before. With this pull request there will be three possible ways to set a coverage threshold:
global
applies the threshold to every covered file.path
applies the threshold to a path (either a directory or a file).glob
applies the threshold to any file matching a glob pattern.For example, before you could do:
And this would apply a threshold separately...
"./src/components/**/*.js"
glob pattern"./src/api/very-important-module.js"
fileglobal
threshold).But what if you want to set a threshold for the entire components directory? That is, what if you don't care about the threshold of each individual
.js
file in the components directory, but you do want to set a combined coverage threshold for all your components. Something like:And this would apply a threshold separately...
"./src/components"
directory (combined coverage for each file under the directory)."./src/reducers/**/*.js"
glob pattern."./src/api/very-important-module.js"
fileglobal
threshold).Test plan
I added a few unit tests that tests this new functionality. I left every other test in the test suite alone to demonstrate that there are no regressions in functionality. Let me know if you think we need to add some more tests, or if there are some integration test that I can create/update.