Skip to main content

method Deno.DenoTest.afterEach

#DenoTest.afterEach(fn: () => void | Promise<void>): void

Register a function to be called after each test in the current scope.

These functions are run in LIFO order (last in, first out).

If an exception is raised during execution of this hook, the remaining hooks will not be run and the currently running test case will be marked as failed.

Deno.test.afterEach(() => {
  // Cleanup code that runs after each test
  console.log("Cleaning up test");
});

Parameters #

#fn: () => void | Promise<void>

Return Type #

void

Did you find what you needed?

Privacy policy