Skip to content

Commit

Permalink
Address review concerns
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Finlay committed Mar 20, 2019
1 parent a054fbc commit 82bb259
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,18 @@ NYC.prototype._readTranspiledSource = function (filePath) {
}

NYC.prototype.addAllFiles = function () {
const visitor = relFile => {
this._loadAdditionalModules()

this.fakeRequire = true
this.walkAllFiles(this.cwd, relFile => {
const filename = path.resolve(this.cwd, relFile)
this.addFile(filename)
const coverage = coverageFinder()
const lastCoverage = this.instrumenter().lastFileCoverage()
if (lastCoverage) {
coverage[lastCoverage.path] = lastCoverage
}
}

this._loadAdditionalModules()

this.fakeRequire = true
this.walkAllFiles(this.cwd, visitor)
})
this.fakeRequire = false

this.writeCoverageFile()
Expand Down Expand Up @@ -214,13 +212,15 @@ NYC.prototype._transform = function (code, filename) {
const extname = path.extname(filename).toLowerCase()
const transform = this.transforms[extname] || (() => null)

return transform(code, { filename: filename })
return transform(code, { filename })
}

NYC.prototype._maybeInstrumentSource = function (code, filename) {
const instrument = this.exclude.shouldInstrument(filename)
if (!this.exclude.shouldInstrument(filename)) {
return null
}

return (instrument) ? this._transform(code, filename) : null
return this._transform(code, filename)
}

NYC.prototype._transformFactory = function (cacheDir) {
Expand Down

0 comments on commit 82bb259

Please sign in to comment.