I want to set timeout value on before hook in mocha test cases. I know I can do that by adding -t 10000 on the command line of mocha but this will change every
Calling this.timeout(milliseconds); in the before hook is correct. Anyway, you need to use a regular function for the hook (function (done) ...) rather than an arrow function (done => ...).
before(
function(done) {
this.timeout(10000);
...
}
);
And the reason is that arrow functions have no this binding.