Skip to content

Commit 0dd970c

Browse files
authored
feat: cache now turned on by default (#454)
BREAKING CHANGE: nyc's cache is now enabled by default
1 parent c3c4d38 commit 0dd970c

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* global __coverage__ */
22
var arrify = require('arrify')
3+
var debugLog = require('debug-log')('nyc')
34
var fs = require('fs')
45
var glob = require('glob')
56
var libCoverage = require('istanbul-lib-coverage')
@@ -270,7 +271,7 @@ NYC.prototype._transformFactory = function (cacheDir) {
270271
instrumented = instrumenter.instrumentSync(code, filename, sourceMap)
271272
} catch (e) {
272273
// don't fail external tests due to instrumentation bugs.
273-
console.warn('failed to instrument', filename, 'with error:', e.stack)
274+
debugLog('failed to instrument ' + filename + 'with error: ' + e.stack)
274275
instrumented = code
275276
}
276277

lib/config-util.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Config.buildYargs = function (cwd) {
133133
})
134134
.option('cache', {
135135
alias: 'c',
136-
default: false,
136+
default: true,
137137
type: 'boolean',
138138
describe: 'cache instrumentation results for improved performance'
139139
})

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"rimraf": "^2.5.4",
9696
"signal-exit": "^3.0.1",
9797
"spawn-wrap": "^1.2.4",
98-
"test-exclude": "^3.2.2",
98+
"test-exclude": "^3.3.0",
9999
"yargs": "^6.4.0",
100100
"yargs-parser": "^4.0.2"
101101
},
@@ -104,6 +104,7 @@
104104
"bundle-dependencies": "^1.0.2",
105105
"chai": "^3.0.0",
106106
"coveralls": "^2.11.11",
107+
"debug-log": "^1.0.1",
107108
"exists-sync": "0.0.4",
108109
"forking-tap": "^0.1.1",
109110
"is-windows": "^0.2.0",
@@ -112,8 +113,8 @@
112113
"requirejs": "^2.3.0",
113114
"sanitize-filename": "^1.5.3",
114115
"sinon": "^1.15.3",
115-
"split-lines": "^1.0.0",
116116
"source-map-support": "^0.4.6",
117+
"split-lines": "^1.0.0",
117118
"standard": "^8.0.0",
118119
"standard-version": "^3.0.0",
119120
"tap": "^8.0.0",
@@ -157,4 +158,4 @@
157158
"find-up"
158159
]
159160
}
160-
}
161+
}

test/src/nyc-bin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ describe('the nyc cli', function () {
655655
fs.readFileSync(file, 'utf-8')
656656
))
657657
})
658-
Object.keys(coverage)[0].should.equal('./external-instrumenter.js')
658+
Object.keys(coverage).should.include('./external-instrumenter.js')
659659

660660
// we should not have executed file, so all counts sould be 0.
661661
var sum = 0

0 commit comments

Comments
 (0)