question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`c8 ignore next` comment does not quite appropriately compensate for branches

See original GitHub issue
  • Version: v14.12.0
  • Platform: macOS Darwin Kernel Version 19.6.0

Given this code in index.js:

function fn() {
  return true;
  /* c8 ignore next */
  console.log('never runs');
}

fn();

Running with ci node index.js, I get this output:

----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |     100 |    66.67 |     100 |     100 |                   
 index.js |     100 |    66.67 |     100 |     100 | 2                 
----------|---------|----------|---------|---------|-------------------

I would expect the branches to all be considered covered since the entire uncovered branch is excluded by the c8 ignore comment.

----------|---------|----------|---------|---------|-------------------
File      | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------|---------|----------|---------|---------|-------------------
All files |     100 |    100 |     100 |     100 |                   
 index.js |     100 |    100 |     100 |     100 | 2                 
----------|---------|----------|---------|---------|-------------------

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
bcoecommented, Oct 16, 2020

@Trott wow, it too me this long to get to this message in my inbox 😆

I have a cunning plan, I was thinking we could perhaps check if the covered range is only 1 character, at which point I think it’s a good indicator I’ve detected a \n character.

I’ll play with this soon.

1reaction
bcoecommented, Oct 8, 2020

this should be fixed in c8@7.3.2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Title 26: LABOR AND INDUSTRY - Maine Legislature
The employee representative shall not lose any privilege or compensation during or because of his attendance in any such inspection. [PL 1975, c....
Read more >
Skilled Nursing Facilities Patient-Driven Payment Model ...
This report introduces a comprehensive alternative to the current resident classification model (case-mix adjustment) within the skilled nursing facility ...
Read more >
Common Data Set 2020-2021 - Fairfield University
In the ratio calculations, exclude both faculty and students in stand-alone graduate or professional programs such as medicine, law, veterinary, dentistry, ...
Read more >
Proposed Rule: S7-13-00 - SEC.gov
If investors do not believe that the auditor is truly independent from ... auditor can ignore completely what the firm stands to lose...
Read more >
Ibrahim Mahazu, Appellant, vs. Becklund Home Health Care ...
Respondent. Filed July 30, 2002. Affirmed in part, reversed in part, and remanded. Anderson, Judge. Hennepin County District Court. File No.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found