import { expect } from './matchers'; /** * Human-readable validation type identifiers used in natural-language assertion strings. * Each value corresponds to a supported comparison operation and can appear in phrases * parsed by {@link validationRegexp} / {@link validationExtractRegexp}. */ export declare const validations: { EQUAL: string; DEEPLY_EQUAL: string; STRICTLY_EQUAL: string; DEEPLY_STRICTLY_EQUAL: string; HAVE_MEMBERS: string; MATCH: string; CONTAIN: string; ABOVE: string; BELOW: string; GREATER: string; LESS: string; HAVE_TYPE: string; INCLUDE_MEMBERS: string; HAVE_PROPERTY: string; MATCH_SCHEMA: string; CASE_INSENSITIVE_EQUAL: string; SATISFY: string; }; /** * Regexp that **fully** matches a validation phrase and extracts named groups: * - `validation` — the matched {@link validations} value * - `reverse` — present when the phrase contains a negation word (e.g. `"not"`) * - `soft` — present when the phrase contains `"softly"` * * @example * validationExtractRegexp.exec('not deeply equal')?.groups * // => { reverse: 'not ', validation: 'deeply equal', soft: undefined } */ export declare const validationExtractRegexp: RegExp; /** * Regexp that **searches** for a validation phrase within a larger string. * Captures the same named groups as {@link validationExtractRegexp} but does not * require the phrase to occupy the full string. */ export declare const validationRegexp: RegExp; /** Arguments required by the {@link verify} function. */ type VerifyInput = { /** The actual value produced by the system under test. */ received: any; /** The value to compare against. */ expected: any; /** A {@link validations} value identifying the comparison to perform. */ validation: string; /** When `true`, the assertion is negated (i.e. it must *not* pass). */ reverse: boolean; /** When `true`, throws a `SoftAssertionError` instead of an `AssertionError` on failure. */ soft: boolean; }; /** * Runs a single synchronous assertion and throws an enriched error on failure. * * @param received - The actual value produced by the system under test. * @param expected - The value to compare against. * @param validation - A {@link validations} key identifying the comparison to perform. * @param reverse - When `true`, the assertion is negated. * @param soft - When `true`, throws a `SoftAssertionError` instead of an `AssertionError`. * @throws {AssertionError | SoftAssertionError} When the assertion fails. */ export declare function verify({ received, expected, validation, reverse, soft }: VerifyInput): void; /** * Parses a natural-language validation phrase and returns a ready-to-use assertion function. * * The phrase may include optional modifiers such as `"not"` (negation) and `"softly"` (soft mode). * The returned function calls {@link verify} internally. * * @param validationType - A natural-language string describing the validation * (e.g. `'not deeply equal'`, `'softly contain'`). * @param options - Additional options; `soft: true` forces soft mode regardless of the phrase. * @returns A function `(received, expected) => void` that performs the assertion. * @throws {Error} If `validationType` cannot be parsed. * * @example * const assertEqual = getValidation('equal'); * assertEqual('hello', 'hello'); // passes * assertEqual('hello', 'world'); // throws AssertionError */ export declare function getValidation(validationType: string, options?: { soft: boolean; }): (AR: any, expected: any) => void; /** * Parses a natural-language validation phrase and returns an async polling assertion function. * * The returned function repeatedly calls the `received` factory until the assertion passes * or the timeout is exceeded. Supports the same phrase modifiers as {@link getValidation}. * * @param validationType - A natural-language string describing the validation. * @param options - Additional options; `soft: true` forces soft mode regardless of the phrase. * @returns An async function `(received, expected, options?) => Promise` that polls * until the assertion passes or times out. * @throws {Error} If `validationType` cannot be parsed. * * @example * const pollEqual = getPollValidation('equal'); * await pollEqual(() => fetchStatus(), 'done', { timeout: 10000, interval: 500 }); */ export declare function getPollValidation(validationType: string, options?: { soft: boolean; }): (AR: any, expected: any, options?: { timeout?: number; interval?: number; }) => Promise; /** * Repeatedly invokes `fn` on a fixed interval until it resolves without throwing, * or until the timeout is reached. * * @param fn - An async (or sync) function containing the assertions or logic to retry. * @param options.timeout - Maximum wait time in milliseconds (default: `5000`). * @param options.interval - Polling interval in milliseconds (default: `500`). * @returns A promise that resolves when `fn` passes, or rejects with the last error on timeout. * * @example * await poll(async () => { * const value = await fetchValue(); * expect(value).toBe('ready'); * }, { timeout: 10000 }); */ export declare function poll(fn: Function, options?: { timeout?: number; interval?: number; }): Promise; export { expect };