Skip to content

Exports

The Exports interface allows for organizing tests in a modular fashion. It is particularly useful in larger projects where test suites can be segmented into different files.

The Exports interface is much like Mocha’s predecessor expresso. The keys before, after, beforeEach, and afterEach are special-cased, object values are suites, and function values are test-cases:

module.exports = {
before: function () {
// ...
},
Array: {
"#indexOf()": {
"should return -1 when not present": function () {
[1, 2, 3].indexOf(4).should.equal(-1);
},
},
},
};