Skip to content

Commit

Permalink
Keep cache for local versions of sinon and chai
Browse files Browse the repository at this point in the history
  • Loading branch information
Rickard Svensson committed Nov 6, 2018
1 parent 584002c commit ea1dae8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/register/src/index.js
Expand Up @@ -137,7 +137,9 @@ class AW {
const [filename] = utils.getCurrentFilenameStackInfo(this.testFiles);
const deps = utils.getAllDependencies(this.srcFiles, filename);
deps.forEach(d => utils.safeDeleteCache(d));
Object.keys(require.cache).filter(f => f !== filename && this.testFiles.indexOf(f) === -1).forEach(f => utils.safeDeleteCache(f));

const isTestLibFile = f => f.indexOf('node_modules') > -1 && (f.indexOf('sinon') > -1 || f.indexOf('chai') > -1);
Object.keys(require.cache).filter(f => f !== filename && this.testFiles.indexOf(f) === -1 && !isTestLibFile(f)).forEach(f => utils.safeDeleteCache(f));

const mods = reqs.map((r) => {
const p = require.resolve(path.resolve(path.dirname(filename), r));
Expand Down

0 comments on commit ea1dae8

Please sign in to comment.