after(fn?, options?): void
Attributes
fn?:
Function | AsyncFunctionThe hook function.
If the hook uses callbacks,
the callback function is passed as the second argument. Default: A no-op
function.
options:
ObjectConfiguration options for the hook. The following
properties are supported:
signal:
AbortSignalAllows aborting an in-progress hook.
timeout?:
numberA number of milliseconds the hook will fail after.
If unspecified, subtests inherit this value from their parent.
Default:
Infinity.This function creates a hook that runs after executing a suite.
describe('tests', async () => { after(() => console.log('finished running tests')); it('is a subtest', () => { // Some relevant assertion here }); });
Note: The after hook is guaranteed to run,
even if tests within the suite fail.