Arrow Functions
Passing arrow functions (aka “lambdas”) to Mocha is discouraged.
Lambdas lexically bind this
and cannot access the Mocha context.
For example, the following code will fail:
If you do not need to use Mocha’s context, lambdas should work. Be aware that using lambdas will be more painful to refactor if the need eventually arises!
Alternatively, you can override certain context variables, such as test timeouts, by chain-calling methods of the created tests and/or hooks: