Skip to content

Commit 658dba4

Browse files
princjefbcoe
authored andcommitted
fix: remove excluded files from coverage before writing (#649)
1 parent dd40dc5 commit 658dba4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

index.js

+7
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,13 @@ NYC.prototype.writeCoverageFile = function () {
367367
var coverage = coverageFinder()
368368
if (!coverage) return
369369

370+
// Remove any files that should be excluded but snuck into the coverage
371+
Object.keys(coverage).forEach(function (absFile) {
372+
if (!this.exclude.shouldInstrument(absFile)) {
373+
delete coverage[absFile]
374+
}
375+
}, this)
376+
370377
if (this.cache) {
371378
Object.keys(coverage).forEach(function (absFile) {
372379
if (this.hashCache[absFile] && coverage[absFile]) {

0 commit comments

Comments
 (0)