Function afterEach

  • Run some shared teardown after each test in the suite.

    Type Parameters

    • T

      The self type of the function

    Parameters

    • fn: ((this: T) => void | Promise<void>)

      The function to implement the shared teardown behavior

        • (this): void | Promise<void>
        • Parameters

          • this: T

          Returns void | Promise<void>

    Returns void

    import { describe, it, afterEach } from "@std/testing/bdd";
    import { assertEquals } from "@std/assert";

    afterEach(() => {
    console.log("afterEach");
    });

    describe("example", () => {
    it("should pass", () => {
    // test case
    assertEquals(2 + 2, 4);
    });
    });