how to make Mocha default test runner

I have written mocha tests but when I try to run a single test it defaults to the Node js configuration instead of the Mocha configuration. How can I change the default runner?

2 comments

The logic used for determining what test runner is available for a given test file is based on dependencies declarations in package.json nearest to current file. Do you have 'mocha' listed as a dependency/dev dependency in your package.json

Note that, if Mocha is not installed locally/included in package.json, you can create a Mocha run configuration with "All in directory" selected and specify a directory where your spec files are located. In this case, clicking the gutter button in a test file inside this directory will suggest to run test with Mocha.

Note also that if you have created Node.js Run configuration with "JavaScript file" set to your mocha test file, IDE will suggest using this configuration instead of Mocha when clicking on your tests, because explicitly created run configurations associated with current file have priority over the ones auto-generated from context. Deleting the configuration should solve the issue.

1

deleting the Node JS configuration fixed the issue! Thank you!

1

Please sign in to leave a comment.