node.jsmocha.jsnode-supervisor

rerun mocha using supervisor... on windows


I am trying to rerun mocha tests using supervisor. I have tried:

supervisor node_modules\.bin\mocha

It goes into loop with error:

basedir=`dirname "$0"`

Suggestions?


Solution

  • I think all you want to do is mocha -w:

    -w, --watch                     watch files for changes
    

    It works nicely with the dot-matrix reporter (default) and -G to give you growl notifications when your tests fail.

    Edit:

    I've found the Windows-related issues you mention: "No such module" error when trying to get Mocha to watch my project

    I can't help with that, either.

    But back to the supervisor question: When I install mocha, the "bin" script is in node_modules/mocha/bin, and I can get tests to run repeatedly with the following

    supervisor node_modules/mocha/bin/mocha 
    

    supervisor does print some annoying DEBUG lines between each test run, but those can be silenced with --quiet. Because mocha quits after each run, you have a busy loop of constant tests, though.