Status of coverage icon indicators dont match thresholds set in jest.config.js
See original GitHub issueDescribe a bug
Firstly thanks for taking the time to create this GitHub action! It’s very nice and working pretty much exactly how we want it to.
We are however experiencing some confusion around the ‘Status of coverage’ traffic light icons in the first column of the report.
As per below, both Branches and Functions are reporting that they are ‘Under the threshold’, however our jest.config.js
has the thresholds set as per below so they should be ‘Slightly more then threshold’
coverageThreshold: {
global: {
branches: 56,
functions: 47,
lines: 78,
statements: 79,
},
}
Expected behavior
The ‘Status of coverage’ column icons should show the correct color based on what is set in the jest.config.js
file.
Details
-
Action version:
v2
-
OS, where your action is running (windows, linux):
linux
-
action.yml file
- uses: ArtiomTr/jest-coverage-report-action@v2 with: test-script: yarn jest package-manager: yarn skip-step: install annotations: none
-
Screenshots
Additional context
N/A
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Configuring Jest
You can collect coverage from those files with setting forceCoverageMatch . JavaScript; TypeScript. /** @type {import('jest').Config} */
Read more >Jest test coverage does not fail when threshold is not met
My understanding from the Jest documentation is that an error should be returned when coverage thresholds are not met. If thresholds aren't met ......
Read more >vscode-jest - Visual Studio Marketplace
Build Status Coverage Status Visual Studio Marketplace ... The tests and status do not match or some tests showing question marks ...
Read more >Frontend testing standards and style guidelines - GitLab Docs
The default timeout for Jest is set in /spec/frontend/test_setup.js . ... that the library knows what it's supposed to do and has test...
Read more >VS Code tutorial - Wallaby.js
Regardless of your Files: Auto Save setting value in VS Code, Wallaby runs your tests as you type and you don't need to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for the detailed response @ArtiomTr! I like the overall plan, the new status table makes a lot more sense, although the table would probably end up having a single row for most people. 🤷♂️
I think that as one of the first step I will have to add some tests for this part, because (as far as I can tell) the coverage is a bit lacking in this area 😅 Do you have any recommendations on how I should go about it? Like adding more tests to
tests/run.test.ts
or just refactorsrc/stages/checkThreshold.ts
to make it more easily testable?!Hello @raspo 👋,
Thank you for taking on this issue! I can’t remember, what was the reason for doing this. All this threshold-checking logic is implemented a bit incorrectly, so I’ve abandoned this logic in favour of the newly created package @covbot/jest-threshold. This package runs the same algorithm as jest does, but outputs much more useful output.
So, I wanted to rework the whole “status” logic a bit, to output more useful information in the report. Instead of showing generic statuses in the report, this algorithm could be performed:
The new status table could look like this:
Where the coverages are being shown per each threshold group, in the format “covered% (threshold%)”. I think this format would give the most correct presentation on how coverage changed in PR.
That’s a quite large task, so any help would be appreciated. For instance, you can begin by just replacing the old threshold-checking logic with a new one from the
@covbot/jest-threshold
package. Thank you in advance.