In serial mode, run after all tests end, once only. In parallel mode, run after all tests end, for each file.
In both modes, run after every test.
In serial mode (Mocha's default), before all tests begin, once only. In parallel mode, run before all tests begin, for each file.
In both modes, run before each test.
An alternative way to define root hooks that works with parallel runs.
Root hooks work with any interface, but the property names do not change. In other words, if you are using the tdd interface, suiteSetup maps to beforeAll, and setup maps to beforeEach.
As with other hooks,
this
refers to to the current context object.https://mochajs.org/#root-hook-plugins