I'm using mocha for javascript unit-testing now.
I have several test files, each file has a before
and beforeEach
, but they are exactly the same.
How do I provide a global before
and beforeEach
for all of them (or some of them)?
In the root of the test folder, create a global test helper test/helper.js
which has your before and beforeEach
// globals
global.assert = require('assert');
// setup
before();
beforeEach();
// teardown
after();
afterEach();