Skip to content

Commit

Permalink
fix: add a feature which allows us to bust the cache when breaking ch…
Browse files Browse the repository at this point in the history
…anges are introduced
  • Loading branch information
Benjamin Coe committed Sep 15, 2016
1 parent bc0a99a commit ca5e887
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ try {
ProcessInfo = require('./lib/process.js')
}

var CACHE_VERSION = '2'

/* istanbul ignore next */
if (/index\.covered\.js$/.test(__filename)) {
require('./lib/self-coverage-helper')
Expand Down Expand Up @@ -83,13 +85,14 @@ function NYC (config) {

NYC.prototype._createTransform = function (ext) {
var _this = this

return cachingTransform({
salt: JSON.stringify({
istanbul: require('istanbul-lib-coverage/package.json').version,
nyc: require('./package.json').version
}),
hash: function (code, metadata, salt) {
var hash = md5hex([code, metadata.filename, salt])
var hash = md5hex([code, metadata.filename, salt]) + '_' + CACHE_VERSION
_this.hashCache[metadata.filename] = hash
return hash
},
Expand Down

0 comments on commit ca5e887

Please sign in to comment.