Skip to content

Commit

Permalink
fix: remove excluded files from coverage before writing (#649)
Browse files Browse the repository at this point in the history
  • Loading branch information
princjef authored and bcoe committed Sep 5, 2017
1 parent dd40dc5 commit 658dba4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.js
Expand Up @@ -367,6 +367,13 @@ NYC.prototype.writeCoverageFile = function () {
var coverage = coverageFinder()
if (!coverage) return

// Remove any files that should be excluded but snuck into the coverage
Object.keys(coverage).forEach(function (absFile) {
if (!this.exclude.shouldInstrument(absFile)) {
delete coverage[absFile]
}
}, this)

if (this.cache) {
Object.keys(coverage).forEach(function (absFile) {
if (this.hashCache[absFile] && coverage[absFile]) {
Expand Down

0 comments on commit 658dba4

Please sign in to comment.