Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I was able to make it work on windows by changing a couple of mocha source code files. After npm install mocha (in my case I installed it just for my project, not globally):</p> <p>1) First go to <strong>node_modules\mocha\lib\utils.js</strong> find and fix <em>watch</em> function as follows:</p> <pre><code>exports.watch = function(files, fn) { var options = { interval: 100 }; files.forEach(function(file) { debug('file %s', file); fs.watch(file, options, function(curr, prev) { fn(file); }); }); }; </code></pre> <p>I replaced fs.watchFile with fs.watch (see <a href="https://github.com/fgnass/node-dev/issues/26" rel="nofollow noreferrer">https://github.com/fgnass/node-dev/issues/26</a> for details) because the first one doesn't seem to work on windows.</p> <p>2) Now open <strong>node_modules\mocha\bin\_mocha</strong> and apply following fixes:</p> <p>a) Find and comment out or remove following code:</p> <pre><code>process.on('SIGINT', function(){ showCursor(); console.log('\n'); process.exit(); }); </code></pre> <p>Since there's no equivalent of POSIX signals lines above have to be removed (ideally replaced by proper implementation, see <a href="https://stackoverflow.com/questions/10021373/what-is-the-windows-equivalent-of-process-onsigint-in-node-js">What is the Windows equivalent of process.on(&#39;SIGINT&#39;) in node.js?</a> for more details)</p> <p>b) Find following code <em>utils.watch(watchFiles, function(){...</em> and replace it with </p> <pre><code> var lastRun = new Date(); utils.watch(watchFiles, function(){ if (new Date() - lastRun &gt; 300) { purge(); stop() mocha.suite = mocha.suite.clone(); ui = interfaces[program.ui](mocha.suite); loadAndRun(); lastRun = new Date(); } }); </code></pre> <p>It throttles excessive callacks from fs.watch.</p> <p>c) Last change is removing or commenting out this line:</p> <pre><code> process.stdout.write('\r' + str); </code></pre> <p>in <em>function play(arr, interval)</em>. It just removes noise.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload