Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage HTML report colors should follow coverageThreshold values #6578

Closed
nemoDreamer opened this issue Jun 29, 2018 · 3 comments
Closed

Comments

@nemoDreamer
Copy link

馃殌 Feature Proposal

Istanbul / lcov provides a way to define min/med values to correspond to the red/yellow/green visual clues.

This is done via settings in a .lcovrc file:
https://www.systutorials.com/docs/linux/man/5-lcovrc/
https://stackoverflow.com/questions/40618939/lcov-html-report-coverage-limits

Jest allows us to define custom coverage thresholds using --coverageThreshold CLI argument/config file setting.

The coloration of the lcov HTML report should follow these values and not color a missed threshold green.

Motivation

We've set our global thresholds to 100%:

coverageThreshold: {
  global: {
    // 100%!
    branches: 100,
    functions: 100,
    lines: 100,
    // no uncovered statements!
    statements: 0,
  },
},

But (outside of the CLI) we have to painstakingly scan our coverage report to find that one 98.72% miss:

code_coverage_report_for_all_files

Example

Some possible solutions:

Zero-config?

We realize that Jest's coverageThreshold is more granular, allowing for global and per-glob overrides, but at least mapping the global lines/branches/functions to lcov's genhtml_hi_limit/genhtml_branch_hi_limit/genhtml_function_hi_limit would be a big improvement.

.lcovrc support?

Allow a discoverable .lcovrc (this would allow the use of all lcov config options). Start discovery in package root or sibling to config.js? Or add an --lcovConfig arg alongside --config/-c?

Pitch

Since the coverageThreshold setting is a core setting, and not only supported by a custom reporter, we feel that this belongs here.

@yuliaHope
Copy link

yuliaHope commented Sep 4, 2018

@nemoDreamer you can use .istanbul.yml for this purpose.
For Example:

reporting:
    watermarks:
        statements: [50, 100]
        lines: [50, 100]
        functions: [50, 100]
        branches: [50, 100]

Where the firs value is top border for low coverage and the second one is bottom border for high coverage.

@SimenB
Copy link
Member

SimenB commented Oct 20, 2018

I think we can fold this into #4103 - it's basically "configure coverage reporter".

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants