@@ -48,6 +48,7 @@ function NYC (config) {
48
48
this . _reportDir = config . reportDir || 'coverage'
49
49
this . _sourceMap = typeof config . sourceMap === 'boolean' ? config . sourceMap : true
50
50
this . _showProcessTree = config . showProcessTree || false
51
+ this . _eagerInstantiation = config . eager || false
51
52
this . cwd = config . cwd || process . cwd ( )
52
53
53
54
this . reporter = arrify ( config . reporter || 'text' )
@@ -91,7 +92,7 @@ function NYC (config) {
91
92
NYC . prototype . _createTransform = function ( ext ) {
92
93
var _this = this
93
94
94
- return cachingTransform ( {
95
+ var opts = {
95
96
salt : JSON . stringify ( {
96
97
istanbul : require ( 'istanbul-lib-coverage/package.json' ) . version ,
97
98
nyc : require ( './package.json' ) . version
@@ -101,11 +102,16 @@ NYC.prototype._createTransform = function (ext) {
101
102
_this . hashCache [ metadata . filename ] = hash
102
103
return hash
103
104
} ,
104
- factory : this . _transformFactory . bind ( this ) ,
105
105
cacheDir : this . cacheDirectory ,
106
106
disableCache : ! this . enableCache ,
107
107
ext : ext
108
- } )
108
+ }
109
+ if ( this . _eagerInstantiation ) {
110
+ opts . transform = this . _transformFactory ( this . cacheDirectory )
111
+ } else {
112
+ opts . factory = this . _transformFactory . bind ( this )
113
+ }
114
+ return cachingTransform ( opts )
109
115
}
110
116
111
117
NYC . prototype . _loadAdditionalModules = function ( ) {
0 commit comments