From ca5e887d29ee9c33e441950de3c2a2e81f2cfbfe Mon Sep 17 00:00:00 2001 From: Benjamin Coe Date: Thu, 15 Sep 2016 00:11:46 -0700 Subject: [PATCH] fix: add a feature which allows us to bust the cache when breaking changes are introduced --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index d64c3787f..6ccbc62f4 100755 --- a/index.js +++ b/index.js @@ -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') @@ -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 },