Skip to content

c8 ignore next comment does not quite appropriately compensate for branches #254

@Trott

Description

@Trott
  • 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                 
----------|---------|----------|---------|---------|-------------------

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions