Using the BDD interface, the normal way to do this with mocha is to put something that sets up a test environment in beforeor beforeEach:
describe("foo", function () {
describe("first", function () {
before(function () {
});
beforeEach(function () {
});
it("blah", ...
});
describe("second", function () {
before(function () {
});
beforeEach(function () {
});
it("blah", ...
});
});
If the beforeor parameter beforeEach, which depends on the test, does not work, then the test does not start. Other tests that are independent of it will still be executed. Thus, in the above example, if the callback is transmitted beforein describethe name firstfails, in tests describeunder the name secondwill not be affected at all, and will work, provided that their own beforeand beforeEachdo not return.
In addition, Mocha is designed to run tests that are independent of each other. Therefore, if one itfails, the rest continue to work.
Louis