Skip to content

Commit b0d6dae

Browse files
jl-bcoe
authored andcommitted
fix: coverage reportDir should respect --cwd (#764)
when invoked with `nyc --cwd sub-directory`, coverage reports were saved in `./coverage`, shouldn't it be `./sub-directory/coverage`?
1 parent 6d51456 commit b0d6dae

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ NYC.prototype.report = function () {
444444
var tree
445445
var map = this._getCoverageMapFromAllCoverageFiles()
446446
var context = libReport.createContext({
447-
dir: this._reportDir,
447+
dir: this.reportDirectory(),
448448
watermarks: this.config.watermarks
449449
})
450450

@@ -537,6 +537,10 @@ NYC.prototype.tempDirectory = function () {
537537
return path.resolve(this.cwd, this._tempDirectory)
538538
}
539539

540+
NYC.prototype.reportDirectory = function () {
541+
return path.resolve(this.cwd, this._reportDir)
542+
}
543+
540544
NYC.prototype.processInfoDirectory = function () {
541545
return path.resolve(this.tempDirectory(), 'processinfo')
542546
}

0 commit comments

Comments
 (0)