Skip to content

Commit

Permalink
Clear the require cache before overriding fs
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaub committed Jul 9, 2016
1 parent b996e89 commit 51bc0fb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
'use strict';

/**
* Clear the require cache so that other modules that patch fs get evaulated
* again after this one.
*/
Object.keys(require.cache).forEach(function(key) {
if (key.indexOf(__dirname) === -1) {
delete require.cache[key];
}
});

var realFs = require('fs');
var path = require('path');

Expand Down

0 comments on commit 51bc0fb

Please sign in to comment.