How to set timeout on before hook in mocha?

You need to set a timeout in your describe block rather than in the hook if you want it to affect all the tests in the describe. However, you need to use a “regular” function as the callback to describe rather than an arrow function: describe(‘test’, function () { this.timeout(10000); before(…); it(…); }); In all … Read more

How to programmatically skip a test in mocha?

You can skip tests by placing an x in front of the describe or it block, or placing a .skip after it. xit(‘should work’, function (done) {}); describe.skip(‘features’, function() {}); You can also run a single test by placing a .only on the test. for instance describe(‘feature 1’, function() {}); describe.only(‘feature 2’, function() {}); describe(‘feature … Read more