import { AssertionError as NodeAssertionError } from 'node:assert'; /** * Error thrown when an assertion fails. * Extends the built-in Node.js `AssertionError` with a fixed `name` property. */ export declare class AssertionError extends NodeAssertionError { name: string; } /** * Error thrown when a *soft* assertion fails. * Unlike {@link AssertionError}, soft assertion errors are intended to be collected * and reported together rather than halting execution immediately. */ export declare class SoftAssertionError extends AssertionError { name: string; } /** * Context object available as `this` inside a matcher function. * @template Target - Type of the value being tested. */ export type MatcherContext = { /** The value under test, resolved from the factory function when polling. */ received: Target; /** Whether the assertion is negated (`.not`). */ isNot: boolean; /** Whether the assertion uses soft mode (`.soft`). */ isSoft: boolean; /** Whether the assertion is running in poll mode. */ isPoll: boolean; formatMessage(received: any, expected: any, assert: string, isNot: boolean): string; asString(value: any): string; }; /** * Object returned by every matcher function. * `pass` indicates whether the assertion passed; * `message` is displayed when the assertion fails (or when `.not` negates a passing assertion). */ export type MatcherResult = { pass: boolean; message: string; }; type MatcherReturn = MatcherResult | Promise; type MatcherFn = (this: MatcherContext, ...rest: Args) => MatcherReturn; type MatcherMap = Record; /** * Core assertion class. Wraps a received value and exposes matcher methods through a Proxy. * Instances are normally created via the {@link expect} factory function — you rarely need * to instantiate this class directly. * * @template Target - Type of the value under test. * @template Matcher - Map of custom matchers registered via {@link expect.extend}. */ export declare class Expect { received: Target; isSoft: boolean; isPoll: boolean; pollConfiguration: { timeout: number; interval: number; }; isNot: boolean; /** * @param received - The value to test. * @param configuration - Optional flags to pre-configure the assertion. */ constructor(received: Target, configuration?: { soft?: boolean; poll?: boolean; not?: boolean; }); /** * Negates the matcher — the assertion passes when the matcher would normally fail * and vice versa. */ get not(): this; /** * Enables soft assertion mode. A soft assertion throws a {@link SoftAssertionError} * instead of an {@link AssertionError}, allowing callers to collect multiple failures * before reporting them. */ get soft(): this; get Error(): typeof AssertionError; /** * Enables polling mode: the received value is treated as a factory function and * called repeatedly until the matcher passes or the timeout is reached. * * @param timeout - Maximum wait time in milliseconds (default: `5000`). * @param interval - Polling interval in milliseconds (default: `100`). * @throws {TypeError} If the received value is not a function. */ poll({ timeout, interval }?: { timeout?: number; interval?: number; }): this; /** * Applies multiple configuration flags at once. Unspecified options retain their * current values. * * @param options - Flags to set (`not`, `soft`, `poll`, `timeout`, `interval`). */ configure(options: { not?: boolean; soft?: boolean; poll?: boolean; timeout?: number; interval?: number; }): this; /** * Builds a human-readable assertion failure message. * * @param received - The value that was actually received. * @param expected - The value that was expected. * @param assert - A short phrase describing the assertion (e.g. `'to equal'`). * @param isNot - When `true`, inserts `"not"` into the message. */ formatMessage(received: any, expected: any, assert: string, isNot: boolean): string; /** * Converts any value to a human-readable string for use in assertion messages. * Functions are stringified via `.toString()`; all other values use `util.inspect`. * * @param value - The value to convert. */ asString(value: any): any; } export declare const expect: { (target: Target): Expect & {}; extend(matchers: NewMatcher): { (target: Target): Expect & ({} & NewMatcher extends infer T ? { [Key in keyof T]: T[Key] extends MatcherFn ? (...expected: Args) => ReturnType extends Promise ? Promise> : Target_1 extends (...args: any) => any ? Promise> : Expect : never; } : never); extend(matchers: NewMatcher_1): { (target: Target): Expect & ({} & NewMatcher & NewMatcher_1 extends infer T ? { [Key in keyof T]: T[Key] extends MatcherFn ? (...expected: Args) => ReturnType extends Promise ? Promise> : Target_1 extends (...args: any) => any ? Promise> : Expect : never; } : never); extend(matchers: NewMatcher_2): { (target: Target): Expect & ({} & NewMatcher & NewMatcher_1 & NewMatcher_2 extends infer T ? { [Key in keyof T]: T[Key] extends MatcherFn ? (...expected: Args) => ReturnType extends Promise ? Promise> : Target_1 extends (...args: any) => any ? Promise> : Expect : never; } : never); extend(matchers: NewMatcher_3): { (target: Target): Expect & ({} & NewMatcher & NewMatcher_1 & NewMatcher_2 & NewMatcher_3 extends infer T ? { [Key in keyof T]: T[Key] extends MatcherFn ? (...expected: Args) => ReturnType extends Promise ? Promise> : Target_1 extends (...args: any) => any ? Promise> : Expect : never; } : never); extend(matchers: NewMatcher_4): { (target: Target): Expect & ({} & NewMatcher & NewMatcher_1 & NewMatcher_2 & NewMatcher_3 & NewMatcher_4 extends infer T ? { [Key in keyof T]: T[Key] extends MatcherFn ? (...expected: Args) => ReturnType extends Promise ? Promise> : Target_1 extends (...args: any) => any ? Promise> : Expect : never; } : never); extend(matchers: NewMatcher_5): { (target: Target): Expect & ({} & NewMatcher & NewMatcher_1 & NewMatcher_2 & NewMatcher_3 & NewMatcher_4 & NewMatcher_5 extends infer T ? { [Key in keyof T]: T[Key] extends MatcherFn ? (...expected: Args) => ReturnType extends Promise ? Promise> : Target_1 extends (...args: any) => any ? Promise> : Expect : never; } : never); extend(matchers: NewMatcher_6): { (target: Target): Expect & ({} & NewMatcher & NewMatcher_1 & NewMatcher_2 & NewMatcher_3 & NewMatcher_4 & NewMatcher_5 & NewMatcher_6 extends infer T ? { [Key in keyof T]: T[Key] extends MatcherFn ? (...expected: Args) => ReturnType extends Promise ? Promise> : Target_1 extends (...args: any) => any ? Promise> : Expect : never; } : never); extend(matchers: NewMatcher_7): { (target: Target): Expect & ({} & NewMatcher & NewMatcher_1 & NewMatcher_2 & NewMatcher_3 & NewMatcher_4 & NewMatcher_5 & NewMatcher_6 & NewMatcher_7 extends infer T ? { [Key in keyof T]: T[Key] extends MatcherFn ? (...expected: Args) => ReturnType extends Promise ? Promise> : Target_1 extends (...args: any) => any ? Promise> : Expect : never; } : never); extend(matchers: NewMatcher_8): { (target: Target): Expect & ({} & NewMatcher & NewMatcher_1 & NewMatcher_2 & NewMatcher_3 & NewMatcher_4 & NewMatcher_5 & NewMatcher_6 & NewMatcher_7 & NewMatcher_8 extends infer T ? { [Key in keyof T]: T[Key] extends MatcherFn ? (...expected: Args) => ReturnType extends Promise ? Promise> : Target_1 extends (...args: any) => any ? Promise> : Expect : never; } : never); extend(matchers: NewMatcher_9): { (target: Target): Expect & ({} & NewMatcher & NewMatcher_1 & NewMatcher_2 & NewMatcher_3 & NewMatcher_4 & NewMatcher_5 & NewMatcher_6 & NewMatcher_7 & NewMatcher_8 & NewMatcher_9 extends infer T ? { [Key in keyof T]: T[Key] extends MatcherFn ? (...expected: Args) => ReturnType extends Promise ? Promise> : Target_1 extends (...args: any) => any ? Promise> : Expect : never; } : never); extend(matchers: NewMatcher_10): /*elided*/ any; }; }; }; }; }; }; }; }; }; }; }; export {};