function
test.beforeAll
fn: () => void | Promise<unknown> | (done: (err?: unknown) => void) => void,
options?: HookOptions
): void;
Runs a function, once, before all the tests.
This is useful for running set up tasks, like initializing a global variable or connecting to a database.
If this function throws, tests will not run in this file.
@param fn
the function to run
let database;
beforeAll(async () => {
database = await connect("localhost");
});