function
test.beforeEach
fn: () => void | Promise<unknown> | (done: (err?: unknown) => void) => void,
options?: HookOptions
): void;
Runs a function before each test.
Use this for setup, like initializing a global variable or connecting to a database.
If the function throws, the test does not run.
@param fn
the function to run