File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,6 +84,8 @@ function NYC (config) {
8484
8585 this . processInfo = new ProcessInfo ( config && config . _processInfo )
8686 this . rootId = this . processInfo . root || this . generateUniqueID ( )
87+ this . instrument = config . instrument
88+ this . all = config . all
8789}
8890
8991NYC . prototype . _createTransform = function ( ext ) {
@@ -166,6 +168,9 @@ NYC.prototype.addAllFiles = function () {
166168 _this . addFile ( filename )
167169 var coverage = coverageFinder ( )
168170 var lastCoverage = _this . instrumenter ( ) . lastFileCoverage ( )
171+ if ( lastCoverage ) {
172+ filename = lastCoverage . data . path ;
173+ }
169174 if ( lastCoverage && _this . exclude . shouldInstrument ( filename ) ) {
170175 coverage [ filename ] = lastCoverage
171176 }
@@ -233,7 +238,7 @@ NYC.prototype.walkAllFiles = function (dir, visitor) {
233238}
234239
235240NYC . prototype . _maybeInstrumentSource = function ( code , filename , relFile ) {
236- var instrument = this . exclude . shouldInstrument ( filename , relFile )
241+ var instrument = ( ! this . instrument && this . all ) || this . exclude . shouldInstrument ( filename , relFile )
237242 if ( ! instrument ) {
238243 return null
239244 }
Original file line number Diff line number Diff line change 1+ var FileCoverage = require ( 'istanbul-lib-coverage' ) . classes . FileCoverage
2+ var readInitialCoverage = require ( 'istanbul-lib-instrument' ) . readInitialCoverage
3+
14function NOOP ( ) {
25 return {
36 instrumentSync : function ( code ) {
7+ var extracted = readInitialCoverage ( code )
8+ if ( extracted ) {
9+ this . fileCoverage = new FileCoverage ( extracted . coverageData )
10+ } else {
11+ this . fileCoverage = null
12+ }
413 return code
514 } ,
615 lastFileCoverage : function ( ) {
7- return null
16+ return this . fileCoverage
817 }
918 }
1019}
You can’t perform that action at this time.
0 commit comments