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.
Please sign in to leave a comment.
If you mean "how to debug a single test file in Webstorm", I used this technique and it works great:
http://wuntusk.blogspot.com/2012/06/using-webstorm-or-phpstorm-and-mocha.html
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 = mocha.run(function(){
console.log('[*=- Finished -=*]');
process.exit(0);
});
Otherwise, the process never exits.
Thank you John, that suggestion works great. Thank You.