Skip to content

Commit 7ac325d

Browse files
tayecoreyfarrell
authored andcommitted
fix: add config values to hash salt (#988)
Fixes #522
1 parent 7b5dad5 commit 7ac325d

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function NYC (config) {
9999

100100
NYC.prototype._createTransform = function (ext) {
101101
var opts = {
102-
salt: Hash.salt,
102+
salt: Hash.salt(this.config),
103103
hashData: (input, metadata) => [metadata.filename],
104104
onHash: (input, metadata, hash) => {
105105
this.hashCache[metadata.filename] = hash

lib/hash.js

+26-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
11
'use strict'
22

3+
function getInvalidatingOptions (config) {
4+
return [
5+
'compact',
6+
'esModules',
7+
'ignoreClassMethods',
8+
'instrument',
9+
'instrumenter',
10+
'plugins',
11+
'preserveComments',
12+
'produceSourceMap',
13+
'sourceMap'
14+
].reduce((acc, optName) => {
15+
acc[optName] = config[optName]
16+
return acc
17+
}, {})
18+
}
19+
320
module.exports = {
4-
salt: JSON.stringify({
5-
istanbul: require('istanbul-lib-coverage/package.json').version,
6-
nyc: require('../package.json').version
7-
})
21+
salt (config) {
22+
return JSON.stringify({
23+
modules: {
24+
'istanbul-lib-instrument': require('istanbul-lib-instrument/package.json').version,
25+
nyc: require('../package.json').version
26+
},
27+
nycrc: getInvalidatingOptions(config)
28+
})
29+
}
830
}

0 commit comments

Comments
 (0)