Run a single Mocha test file?

Is there a way to direct that Mocha only run a single test file? I know how to restrict mocha to run only tests in a particular directory. But I would rather be able to specific a single file.

Comment actions Permalink

If you mean "how to debug a single test file in Webstorm", I used this technique and it works great:

Basically, you create a small script file that adds the file(s) you want to test, and set up a new debug configuration to run just that script file. It then runs and debugs Mocha on just the files you want.

I did have to modify the last section of the file to exit properly in the newest version of webstorm, like so:

var runner ={
  console.log('[*=- Finished -=*]');

Otherwise, the process never exits.
Comment actions Permalink

Thank you John, that suggestion works great. Thank You.


Please sign in to leave a comment.