FafterEach
Bun

function

test.afterEach

function afterEach(
fn?: HookFn,
options?: HookOptions
): void;

This function creates a hook that runs after each test in the current suite. The afterEach() hook is run even if the test fails.

describe('tests', async () => {
  afterEach(() => console.log('finished running a test'));
  it('is a subtest', () => {
    assert.ok('some relevant assertion here');
  });
});
@param fn

The hook function. If the hook uses callbacks, the callback function is passed as the second argument.

@param options

Configuration options for the hook.