Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

Fixed --watch, purge require cache. Closes #266

TJ Holowaychuk06f299f08509
diff --git a/bin/_mocha b/bin/_mocha
index d94cbec0..ae28dd70 100755
--- a/bin/_mocha
+++ b/bin/_mocha
@@ -209,7 +209,16 @@ if (program.watch) {
play(frames);
- utils.watch(utils.files(cwd), function(){
+ var watchFiles = utils.files(cwd);
+
+ function purge() {
+ watchFiles.forEach(function(file){
+ delete require.cache[file];
+ });
+ }
+
+ utils.watch(watchFiles, function(){
+ purge();
stop()
suite = suite.clone();
ui = interfaces[program.ui](suite);