Bun

namespace

test.assert

namespace assert

An object whose methods are used to configure available assertions on the TestContext objects in the current process. The methods from node:assert and snapshot testing functions are available by default.

It is possible to apply the same configuration to all files by placing common configuration code in a module preloaded with --require or --import.

  • function register(
    name: string,
    fn: (this: TestContext, ...args: any[]) => void
    ): void;

    Defines a new assertion function with the provided name and function. If an assertion already exists with the same name, it is overwritten.