karma-runner / karma-runner/karma-coverage

Untested Default Parameters Not marked in html report

Open
#336 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

I'm not sure if this issue belongs here or with istanbul, but I've noticed that when the implicit branch created by a default parameter is untested, it does not get marked in the html report.

I have a function that looks like this

```js
function foo(e){
...
}
```

and it's 100% covered

if i change it to

```js
function foo(e = {}){
...
}
```
the coverage report correctly says that i'm missing a branch. but when i look at the html report, it is not highlighted in any way. The top of the file says 10/11 branches covered, but it's hard to see what is missing.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the JavaScript default-parameter example and inspect the generated HTML report alongside the branch coverage summary. The fix is complete when the untested implicit branch for the default parameter is visibly marked in the HTML report.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.