Skip to content

🚀 Feature Request: Light Green Squares for Indirect Coverage #3509

@willi84

Description

@willi84

🚀 Feature Request: Light Green Squares for Indirect Coverage

It would be incredibly helpful if the green squares in the coverage visualization could have a light green variant (here showed by blue 🟦) to indicate when a function is only covered indirectly—for example, when it’s executed because another function is tested, not because it's tested directly.

💡 Why this matters

This feature would improve test clarity by distinguishing between:

  • ✅ Functions that are explicitly tested
  • 🟦 Functions that are only incidentally covered (e.g., due to imports or call chains)

This would help identify which parts of the codebase still need independent test coverage—which is crucial for writing meaningful, intentional tests.


📄 Sample Code (JavaScript)

// utils.js
export function directlyTested() {
  return helper(); // indirectly covers helper
}

export function helper() {
  return 'Hello from helper!';
}
// utils.test.js
import { directlyTested } from './utils';

test('directlyTested returns expected value', () => {
  expect(directlyTested()).toBe('Hello from helper!');
});

🧪 Situation

  • directlyTested() is explicitly tested
  • helper() appears covered, but is only executed indirectly
  • There is no direct test for helper()

✅ Current Coverage Report (misleading)

directlyTested: 🟩
helper:         🟩  ← misleading

✅ Proposed Coverage Report

directlyTested: 🟩  (directly tested)
helper:         🟦  (indirectly covered)

🔍 Legend

Symbol Meaning
🟩 Direct test coverage
🟦 Indirectly covered
Not covered

I encountered this while debugging a test that falsely appeared green—turns out the function was only covered due to an import 🙈

Would love to know if this is technically feasible. It would be a game changer for test reliability!


✍️ This issue description was collaboratively optimized with the help of ChatGPT to ensure clarity and completeness.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions