import { _ as TestMessage, a as SuiteSummary, c as TSchema, d as TDraftCondition, f as only, g as TestFn, h as TIsolateTest, i as SuiteResult, l as Suite, m as suiteSelectors, n as TVestIsolate, o as TFieldName, p as skip, r as InferSchemaOutput, s as TGroupName, u as SuiteCallbackWithSchema, v as OptionalsInput } from "./IsolateSuite-t022G3ua.cjs"; import { CB, Nullable, Result } from "vest-utils"; import { IsolateKey, TIsolate } from "vestjs-runtime"; import { enforce } from "n4s"; //#region src/core/isolate/VestReconciler.d.ts declare function registerReconciler(reconciler: IsolateReconciler): void; type IsolateReconciler = { match(currentNode: TIsolate, historyNode: TIsolate): boolean; reconcile(currentNode: TIsolate, historyNode: TIsolate): TIsolate; }; //#endregion //#region src/core/test/test.d.ts declare function vestTest(fieldName: string, message: TestMessage, cb: TestFn): TIsolateTest; declare function vestTest(fieldName: string, cb: TestFn): TIsolateTest; declare function vestTest(fieldName: string, message: TestMessage, cb: TestFn, key: IsolateKey): TIsolateTest; declare function vestTest(fieldName: string, cb: TestFn, key: IsolateKey): TIsolateTest; declare const test: typeof vestTest; //#endregion //#region src/hooks/include.d.ts /** * Conditionally includes a field for testing, based on specified criteria. * * @param {string} fieldName - The name of the field to include for testing. * * @example * include('confirm').when('password'); * // Includes the "confirm" field for testing when the "password" field is included * * include('confirm').when(someValue); * // Includes the "confirm" field for testing when the value of `someValue` is true * * include('confirm').when(() => someValue); * // Includes the "confirm" field for testing when the callback function returns true * * include('username').when(result => result.hasErrors('username')); * // Includes the "username" field for testing when there are errors associated with it in the current suite result */ declare function include(fieldName: F | string): { when: (condition: F | string | TFieldName | TDraftCondition) => void; }; //#endregion //#region src/hooks/optional/Modes.d.ts declare enum Modes { EAGER = "EAGER", ALL = "ALL", ONE = "ONE", } //#endregion //#region src/hooks/optional/mode.d.ts /** * Sets the current execution mode for the current suite. * * Supported modes: * - `EAGER` - (default) Runs all tests, but stops on first failure for each given field. * - `ALL` - Runs all tests, regardless of failures. * - `ONE` - Stops suite execution on first failure of any field. * * @example * ```js * import {Modes, create} from 'vest'; * * const suite = create('suite_name', () => { * vest.mode(Modes.ALL); * * // ... * }); * ``` * @param 'ALL' | 'EAGER' | 'ONE' mode - The mode to set. */ declare function mode(mode: Modes): void; //#endregion //#region src/hooks/optional/optional.d.ts declare function optional(optionals: OptionalsInput): void; //#endregion //#region src/hooks/useWarn.d.ts declare function useWarn(): () => void; //#endregion //#region src/hooks/warn.d.ts /** * Sets the severity level of a test to `warn`, allowing it to fail without marking the suite as invalid. * Use this function within the body of a test to create warn-only tests. * * @returns {void} * * @example * test('password', 'Your password strength is: WEAK', () => { * warn(); * * enforce(data.password).matches(/0-9/); * }); * * @limitations * - The `warn` function should only be used within the body of a `test` function. * - When using `warn()` in an async test, it should be called in the synchronous portion of the test, not after an `await` call or in the Promise body (see `useWarn`). * - It is recommended to call `warn()` at the top of the test function. */ declare function warn(): void; //#endregion //#region src/core/isolate/IsolateEach/IsolateEach.d.ts type TIsolateEach = TVestIsolate; //#endregion //#region src/isolates/each.d.ts /** * Iterates over an array of items, allowing to run tests individually per item. * * Requires setting a "key" property on each item tested. * * @example * * each(itemsArray, (item) => { * test(item.name, 'Item value must not be empty', () => { * enforce(item.value).isNotEmpty(); * }, item.id) * }) */ declare function each(list: T[], callback: (arg: T, index: number) => void): TIsolateEach; //#endregion //#region src/isolates/group.d.ts declare function group(groupName: string, callback: CB): TIsolate; declare function group(callback: CB): TIsolate; //#endregion //#region src/isolates/omitWhen.d.ts /** * Conditionally omits tests from the suite. * * Unlike `skipWhen`, omitted tests are **completely removed** from the * result — they do not retain their previous state and are not counted * in `testCount`, `errorCount`, or validity checks. Use `omitWhen` when * the tests are irrelevant to the current form state (e.g., omit * "confirm password" tests when the password field is empty). * * @example * * // Don't validate confirmation when password is empty * omitWhen(!data.password, () => { * test('confirm', 'Passwords do not match', () => { * enforce(data.confirm).equals(data.password); * }); * }); */ declare function omitWhen(conditional: TDraftCondition, callback: CB): TIsolate; //#endregion //#region src/isolates/skipWhen.d.ts /** * Conditionally skips running tests within the callback. * * Unlike `omitWhen`, skipped tests **retain their previous result** from * the last run. Use `skipWhen` when you want to avoid re-evaluating * tests that already have a known result (e.g., skip an async uniqueness * check while the field still has synchronous validation errors). * * @example * * // Skip the async check while there are sync errors on the field * skipWhen(res => res.hasErrors('username'), () => { * test('username', 'User already taken', async () => await doesUserExist(username)); * }); */ declare function skipWhen(condition: TDraftCondition, callback: CB): TIsolate; //#endregion //#region src/suite/createSuite.d.ts type SuiteConfig = { fields: string; groups?: string; }; declare function createSuite<_Escape>(suiteCallback: [_Escape] extends [null] ? CB : never, schema?: any): [_Escape] extends [null] ? Suite : never; declare function createSuite void = (data: Data, ...args: any[]) => void>(suiteCallback: T, schema?: undefined): Suite; declare function createSuite, ...args: any[]) => void = (data: InferSchemaOutput, ...args: any[]) => void>(suiteCallback: T, schema: S): Suite, string>, TGroupName, T, S>; declare function createSuite(suiteCallback: SuiteCallbackWithSchema, schema?: S): Suite; //#endregion export { Modes, type Suite, type SuiteConfig, type SuiteResult, type SuiteSummary, createSuite as create, each, enforce, group, include, mode, omitWhen, only, optional, registerReconciler, skip, skipWhen, suiteSelectors, test, useWarn, warn }; //# sourceMappingURL=vest.d.cts.map