import { ChildProcessWithoutNullStreams, SpawnOptionsWithoutStdio } from "node:child_process"; //#region src/types.d.ts interface TestInstance { clear: () => void; process: ChildProcessWithoutNullStreams; stdoutArr: Array<{ contents: Buffer | string; timestamp: number; }>; stderrArr: Array<{ contents: Buffer | string; timestamp: number; }>; getStdallStr: () => string; hasExit: () => null | { exitCode: number; }; debug: (maxLength?: number) => void; } //#endregion //#region src/config.d.ts interface Config { /** * WARNING: `unstable` prefix means this API may change in patch and minor releases. * @param cb */ unstable_advanceTimersWrapper: (cb: (...args: Array) => unknown) => unknown; asyncUtilTimeout: number; renderAwaitTime: number; errorDebounceTimeout: number; showOriginalStackTrace: boolean; throwSuggestions: boolean; getInstanceError: (message: string | null, container: TestInstance) => Error; } interface ConfigFn { (existingConfig: Config): Partial; } type Callback = () => T; declare function runWithExpensiveErrorDiagnosticsDisabled(callback: Callback): T; declare function configure(newConfig: ConfigFn | Partial): void; declare function getConfig(): Config; //#endregion //#region src/helpers.d.ts declare function jestFakeTimersAreEnabled(): boolean; declare function getCurrentInstance(): TestInstance | undefined; declare function setCurrentInstance(newInstance: TestInstance): void; declare function debounce) => void>(func: T, timeout: number): (...args: Parameters) => void; /** * This is used to bind a series of functions where `instance` is the first argument * to an instance, removing the implicit first argument. */ declare function bindObjectFnsToInstance(instance: TestInstance, object: Record) => unknown>): Record) => unknown>; //#endregion //#region src/event-map.d.ts declare const eventMap: { sigterm: (instance: TestInstance) => Promise; sigkill: (instance: TestInstance) => Promise; write: (instance: TestInstance, props: { value: string; }) => boolean; }; //#endregion //#region src/events.d.ts type EventMap = typeof eventMap; type EventType = keyof EventMap; type FireFunction = (instance: TestInstance, event: TEventType, options?: Parameters[1]) => boolean | Promise; type FireObject = { [K in EventType]: (instance: TestInstance, options?: Parameters[1]) => boolean | Promise; }; declare const fireEvent: FireFunction & FireObject; //#endregion //#region src/matches.d.ts type MatcherFunction = (content: string, element: TestInstance | null) => boolean; type Matcher = MatcherFunction | RegExp | number | string; type NormalizerFn = (text: string) => string; interface NormalizerOptions extends DefaultNormalizerOptions { normalizer?: NormalizerFn; } interface MatcherOptions { exact?: boolean; /** Use normalizer with getDefaultNormalizer instead */ trim?: boolean; /** Use normalizer with getDefaultNormalizer instead */ stripAnsi?: boolean; /** Use normalizer with getDefaultNormalizer instead */ collapseWhitespace?: boolean; normalizer?: NormalizerFn; /** suppress suggestions for a specific query */ suggest?: boolean; } type Match = (textToMatch: string, node: TestInstance | null, matcher: Matcher, options?: MatcherOptions) => boolean; interface DefaultNormalizerOptions { trim?: boolean; collapseWhitespace?: boolean; stripAnsi?: boolean; } /** * @private */ declare function fuzzyMatches(textToMatch: string, node: TestInstance | null, matcher: Matcher, normalizer: NormalizerFn): boolean; /** * @private */ declare function matches(textToMatch: string, node: TestInstance | null, matcher: Matcher, normalizer: NormalizerFn): boolean; declare function getDefaultNormalizer({ trim, collapseWhitespace, stripAnsi }?: DefaultNormalizerOptions): NormalizerFn; /** * @param {Object} props * Constructs a normalizer to pass to functions in matches.js * @param {boolean|undefined} props.trim The user-specified value for `trim`, without * any defaulting having been applied * @param {boolean|undefined} props.stripAnsi The user-specified value for `stripAnsi`, without * any defaulting having been applied * @param {boolean|undefined} props.collapseWhitespace The user-specified value for * `collapseWhitespace`, without any defaulting having been applied * @param {Function|undefined} props.normalizer The user-specified normalizer * @returns {Function} A normalizer */ declare function makeNormalizer({ trim, stripAnsi, collapseWhitespace, normalizer }: NormalizerOptions): NormalizerFn; //#endregion //#region src/wait-for.d.ts interface waitForOptions { instance?: TestInstance; showOriginalStackTrace?: boolean; timeout?: number; interval?: number; onTimeout?: (error: Error) => Error; stackTraceError?: Error; } declare function waitForWrapper(callback: () => Promise | T, options?: waitForOptions): Promise; //#endregion //#region src/suggestions.d.ts type Variant = "find" | "get" | "query"; //#endregion //#region src/query-helpers.d.ts type WithSuggest = { suggest?: boolean; }; type GetErrorFunction = [string]> = (c: TestInstance | null, ...args: TArguments) => string; interface SelectorMatcherOptions extends MatcherOptions { selector?: string; ignore?: boolean | string; } type QueryMethod, TReturn> = (container: TestInstance, ...args: TArguments) => TReturn; declare function getInstanceError(message: string | null, instance: TestInstance): Error; declare function makeFindQuery(getter: (container: TestInstance, text: Matcher, options?: MatcherOptions) => TQueryFor): (instance: TestInstance, text: Matcher, options?: MatcherOptions, waitForOptions?: waitForOptions) => Promise; declare const wrapSingleQueryWithSuggestion: >(query: (container: TestInstance, ...args: TArguments) => TestInstance | null, queryByName: string, variant: Variant) => (container: TestInstance, ...args: TArguments) => T; declare function buildQueries(queryBy: QueryMethod<[matcher: Matcher, options?: MatcherOptions], TestInstance | null>, getMissingError: GetErrorFunction<[matcher: Matcher, options?: MatcherOptions]>): readonly [(container: TestInstance, matcher: Matcher, options?: MatcherOptions | undefined) => T, (container: TestInstance, matcher: Matcher, options?: MatcherOptions | undefined) => T, (instance: TestInstance, text: Matcher, options?: MatcherOptions, waitForOptions?: waitForOptions) => Promise]; //#endregion //#region src/queries/text.d.ts type QueryByText = (instance: TestInstance, id: Matcher, options?: SelectorMatcherOptions) => T | null; type GetByText = (instance: TestInstance, id: Matcher, options?: SelectorMatcherOptions) => T; type FindByText = (instance: TestInstance, id: Matcher, options?: SelectorMatcherOptions, waitForElementOptions?: waitForOptions) => Promise; declare function getByText(...args: Parameters>): ReturnType>; declare function queryByText(...args: Parameters>): ReturnType>; declare function findByText(...args: Parameters>): ReturnType>; //#endregion //#region src/queries/error.d.ts type QueryByError = (instance: TestInstance, id: Matcher, options?: SelectorMatcherOptions) => T | null; type GetByError = (instance: TestInstance, id: Matcher, options?: SelectorMatcherOptions) => T; type FindByError = (instance: TestInstance, id: Matcher, options?: SelectorMatcherOptions, waitForElementOptions?: waitForOptions) => Promise; declare function getByError(...args: Parameters>): ReturnType>; declare function queryByError(...args: Parameters>): ReturnType>; declare function findByError(...args: Parameters>): ReturnType>; declare namespace index_d_exports { export { FindByError, FindByText, GetByError, GetByText, QueryByError, QueryByText, findByError, findByText, getByError, getByText, queryByError, queryByText }; } //#endregion //#region src/get-queries-for-instance.d.ts type BoundFunction = T extends ((container: TestInstance, ...args: infer P) => infer R) ? (...args: P) => R : never; type BoundFunctions = TQueries extends typeof index_d_exports ? { getByText: (...args: Parameters>>) => ReturnType>; queryByText: (...args: Parameters>>) => ReturnType>; findByText: (...args: Parameters>>) => ReturnType>; } & { [P in keyof TQueries]: BoundFunction; } : { [P in keyof TQueries]: BoundFunction; }; type Query = (container: TestInstance, ...args: Array) => Error | TestInstance | Array | Promise> | Promise | null; interface Queries { [T: string]: Query; } /** * @param instance * @param queries object of functions * @param initialValue for reducer * @returns returns object of functions bound to container */ declare function getQueriesForElement(instance: TestInstance, queries?: T, initialValue?: {}): BoundFunctions; //#endregion //#region src/user-event/keyboard/types.d.ts type keyboardOptions = { /** Delay between keystrokes */ delay: number; /** Keyboard layout to use */ keyboardMap: Array; }; interface keyboardKey { /** Named key descriptor, such as `Enter` or `ArrowLeft` */ code?: string; /** String written to stdin (historically named `hex`) */ hex?: string; } //#endregion //#region src/user-event/keyboard/keyMap.d.ts /** * Named key descriptors supported by the default terminal keyboard. * * Printable text is written directly to stdin and deliberately does not need * an entry here. This map is reserved for named physical keys and terminal * escape sequences. The generated digit and letter entries preserve support * for descriptors such as `[Digit1]`, `[KeyA]`, and `[KeyLowerA]`. */ declare const defaultKeyMap: Array; //#endregion //#region src/user-event/keyboard/index.d.ts declare function keyboard(instance: TestInstance, text: string, options?: Partial): void | Promise; //#endregion //#region src/user-event/index.d.ts declare const userEvent: { keyboard: typeof keyboard; }; //#endregion //#region src/pure.d.ts interface RenderOptions { cwd: string; debug: boolean; spawnOpts: Omit; } type UserEvent = typeof userEvent; type RenderResult = TestInstance & { userEvent: { [P in keyof UserEvent]: BoundFunction; }; } & { [P in keyof typeof index_d_exports]: BoundFunction<(typeof index_d_exports)[P]>; }; declare function render(command: string, args?: Array, opts?: Partial): Promise; declare function cleanup(): Promise; //#endregion //#region src/mutation-observer.d.ts declare class MutationObserver { _cb: () => void; _id: number; constructor(cb: () => void); observe(): void; disconnect(): void; } declare function _runObservers(): void; //#endregion export { BoundFunction, BoundFunctions, Config, ConfigFn, DefaultNormalizerOptions, EventType, FindByError, FindByText, FireFunction, FireObject, GetByError, GetByText, GetErrorFunction, Match, Matcher, MatcherFunction, MatcherOptions, MutationObserver, NormalizerFn, NormalizerOptions, Queries, Query, QueryByError, QueryByText, QueryMethod, RenderOptions, RenderResult, SelectorMatcherOptions, WithSuggest, _runObservers, bindObjectFnsToInstance, buildQueries, cleanup, configure, debounce, defaultKeyMap, findByError, findByText, fireEvent, fuzzyMatches, getByError, getByText, getConfig, getCurrentInstance, getDefaultNormalizer, getInstanceError, getQueriesForElement, jestFakeTimersAreEnabled, type keyboardKey, type keyboardOptions, makeFindQuery, makeNormalizer, matches, index_d_exports as queries, queryByError, queryByText, render, runWithExpensiveErrorDiagnosticsDisabled, setCurrentInstance, waitForWrapper as waitFor, waitForOptions, wrapSingleQueryWithSuggestion }; //# sourceMappingURL=index.d.mts.map