I am just experimenting with Mocha and Mochapack and wanting to set up a Root Hook to fire before every test. According to the Mocha docs, I should place my hooks in a module and "require" them with the --require
flag.
My NPM command is:
"test": "mochapack --colors --growl --webpack-config=node_modules/laravel-mix/setup/webpack.config.js --require jsdom-global/register --require assets/js/tests/roothooks.js --require assets/js/tests/setup.js assets/js/tests/Unit/**/*.spec.js"
My module where the root hook (roothooks.js) is defined is:
exports.mochaHooks = {
beforeEach(done) {
console.log("before!");
done();
}
};
What am I misssing?
(I added the tag mocha-webpack for this question - just to be clear I am using mochapack)