FbeforeEach
Bun

function

test.beforeEach

function beforeEach(
fn: () => void | Promise<unknown> | (done: (err?: unknown) => void) => void
): void;

Runs a function before each test.

This is useful for running set up tasks, like initializing a global variable or connecting to a database.

If this function throws, the test will not run.

@param fn

the function to run