Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

see

https://mochajs.org/#root-hook-plugins

Hierarchy

  • RootHookObject

Index

Properties

Optional afterAll

afterAll: Func | AsyncFunc | Func[] | AsyncFunc[]

In serial mode, run after all tests end, once only. In parallel mode, run after all tests end, for each file.

Optional afterEach

afterEach: Func | AsyncFunc | Func[] | AsyncFunc[]

In both modes, run after every test.

Optional beforeAll

beforeAll: Func | AsyncFunc | Func[] | AsyncFunc[]

In serial mode (Mocha's default), before all tests begin, once only. In parallel mode, run before all tests begin, for each file.

Optional beforeEach

beforeEach: Func | AsyncFunc | Func[] | AsyncFunc[]

In both modes, run before each test.