When Mocha is run from the CLI and another interface is selected, BDD-style tests are still run. For instance, create the following two test files and then run mocha -u exports to see two tests run instead of only one.
test/bdd.js
it("should run only if the other does not", function(){})
test/exports.js
exports["should only run if the other does not"] = function(){}
instead of only one
Instead of a ReferenceError: it is not defined.
Thanks for pointing this out. It's not a priority though.
I brought this up on gitter a couple days ago, but there was no response. This is really bad behavior. Especially since the documentation does a poor job of explaining the hooks. The main explanation of it portrays it that the hooks will always be the ones from the bdd interface, which combined with this bug makes for a bad situation.
Thanks to @codermarcos at #2994, I've also discovered that if --watch is used and this problem occurs the BDD tests on the subsequent watch-triggered runs will niether throw with a reference error nor actually register their tests -- you can get results like "1 passed, 0 pending, 0 failed" the first time followed by results like "0 passed, 0 pending, 0 failed" when the watch is triggerred.
Can be closed, was fixed with release v6 and the implementation of yargs.
Most helpful comment
I brought this up on gitter a couple days ago, but there was no response. This is really bad behavior. Especially since the documentation does a poor job of explaining the hooks. The main explanation of it portrays it that the hooks will always be the ones from the
bddinterface, which combined with this bug makes for a bad situation.