bcoe / bcoe/c8

Issue with overlapping ignore rules

Open
#275 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
2.1k
Forks
99
PR merge metrics
No merged PRs in 30d

Description

* **Version**: c8 version 7.3.5
+ npm --versions
{
npm: '7.3.0',
node: '15.5.0',
v8: '8.6.395.17-node.23',
uv: '1.40.0',
zlib: '1.2.11',
brotli: '1.0.9',
ares: '1.17.1',
modules: '88',
nghttp2: '1.41.0',
napi: '7',
llhttp: '2.1.3',
openssl: '1.1.1i',
cldr: '38.0',
icu: '68.1',
tz: '2020b',
unicode: '13.0'
}
* **Platform**: node:latest image from DockerHub, running in Bitbucket Pipelines

We have started to get code coverage related failures in our build environments, correlated to our build environment moving from Node 15.4 to 15.5 from 'node:latest' DockerHub image.

Suddenly code coverage that was passing has begun failing with lines that we attempt to ignore showing as uncovered.

When looking at these new cases of uncovered lines, we are noticing this happening around cases where we have what are actually overlapping ignore directives set.

For example, one of the cases that surfaced was in the code below.

```
/* c8 ignore next 82 */
const cloneStoreConfigMap = (map, optsDecorator) => {
/* c8 ignore next */
const decoratorFn = optsDecorator || ( (storeOpts) => storeOpts );
...
}
```

Note how the 4th line shown here is actually ignored by both directives. They overlap. What we are finding happening now is that it seems these overlap cases are now causing the prior directive to be turned off. So we show the 2nd line above as covered. It may actually be exercised in our tests, so not sure if this is because of `next 82` directive or actual code execution). The lines starting with the 5th line (my `...` above) until the end of the 82-line function are now showing as uncovered.

Now obviously we have some sloppy use of our ignores here that we need to clean up, but just wanted to open the issue, as nothing in the documentation would lead me to believe these overlapping ignore directives should not work.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.