'Mocha hook for each test and test file

Is it possible to add a hook in mocha 8.1 for each test and test file?

Ex: I want to set a startup delay before each each in all the test files



Solution 1:[1]

export const mochaHooks = {
  beforeEach(done) {
    // do something before every test
    done();
  }
};

https://mochajs.org/#available-root-hooks

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Adi Oz