afterAll

Bun

Symbol

afterAll

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

Runs a function, once, after all the tests.

This is useful for running clean up tasks, like closing a socket or deleting temporary files.

@param fn

the function to run

let database;
afterAll(async () => {
  if (database) {
    await database.close();
  }
});