karma-runner / karma-runner/karma-coverage

Grouping (filtering) coverage data

Open
#376 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
771
Forks
242
PR merge metrics
No merged PRs in 30d

Description

There's a feature I'd like to have, that I think ends up being in this library's wheelhouse:

I want to be able to configure a single run of karma+jasmine to only count coverage from the spec file that tests it (aka "strict coverage", or "no splash coverage"). I'd also like the option to restrict it to just the same folder (so each area of the app, say models and controllers for example, ignores splash coverage from tests for other areas).

I think this is potentially possible: we know when each spec starts and completes, and we can access the raw coverage data, so we should be able to clear out all data at the beginning of each spec, and then save (merge) at the end of the spec.

Ideally it would support a user defined `covers(file, fullSpecName)`, so the user could control what the relevant tests are for each covered file.

I'd be happy to help contribute to this feature, but want to get a gut check on any concerns or pitfalls there might be (or if there's a more appropriate place to introduce this functionality).

EDIT: I specified "a single run" just to rule out approaches like launching karma once for each spec file and merging later; that works but the overhead is very high for large projects.

Contributor guide

Open the contributing guide

Research direction

Start by locating the Karma/Jasmine spec start and completion hooks and the raw coverage integration mentioned in the issue. Assess whether coverage can be isolated and merged per spec or folder within one run, including a user-defined covers(file, fullSpecName) rule. Done means the configured grouping works without launching Karma separately for each spec file.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.