question: Nodal.mocha
boneskull opened this issue · comments
Hi,
Was wondering what drove the creation of TestRunner
& the like? Did you simply want to be able to declare classes? If it's just sharing things like the endpoint()
function, this can be accomplished by attaching a before()
or beforeEach()
hook to the implied "root" suite:
// test/fixture.js
beforeEach(function () {
this.foo = 'bar';
});
// test/test.spec.js
const assert = require('assert');
describe('my thing', function () {
it('should equal "bar"', function () {
assert.ok(this.foo === 'bar');
});
});
Tangentially, endpoint()
seems analogous to Hapi's server#inject()
. This has uses beyond just testing; maybe it could be exposed in Application
?
I'm going to assume you want to keep the classes, but please let me know if I can be of any assistance with Mocha otherwise.