UNPKG

cli-testing-library

Version:

Simple and complete CLI testing utilities that encourage good testing practices.

25 lines (24 loc) 2.04 kB
import { waitForOptions as WaitForOptions } from './wait-for.cjs'; import { Variant } from './suggestions.cjs'; import { TestInstance } from './types.cjs'; import { Matcher, MatcherOptions } from './matches.cjs'; export type WithSuggest = { suggest?: boolean; }; export type GetErrorFunction<TArguments extends Array<any> = [string]> = (c: TestInstance | null, ...args: TArguments) => string; export interface SelectorMatcherOptions extends MatcherOptions { selector?: string; ignore?: boolean | string; } export type QueryMethod<TArguments extends Array<any>, TReturn> = (container: TestInstance, ...args: TArguments) => TReturn; declare function getInstanceError(message: string | null, instance: TestInstance): Error; declare function makeFindQuery<TQueryFor>(getter: (container: TestInstance, text: Matcher, options?: MatcherOptions) => TQueryFor): <T extends TestInstance = TestInstance>(instance: TestInstance, text: Matcher, options?: MatcherOptions, waitForOptions?: WaitForOptions) => Promise<T>; declare const wrapSingleQueryWithSuggestion: <TArguments extends Array<unknown>>(query: (container: TestInstance, ...args: TArguments) => TestInstance | null, queryByName: string, variant: Variant) => <T extends TestInstance = TestInstance>(container: TestInstance, ...args: TArguments) => T; declare function buildQueries(queryBy: QueryMethod<[ matcher: Matcher, options?: MatcherOptions ], TestInstance | null>, getMissingError: GetErrorFunction<[ matcher: Matcher, options?: MatcherOptions ]>): readonly [<T extends TestInstance = TestInstance>(container: TestInstance, matcher: Matcher, options?: MatcherOptions | undefined) => T, <T extends TestInstance = TestInstance>(container: TestInstance, matcher: Matcher, options?: MatcherOptions | undefined) => T, <T extends TestInstance = TestInstance>(instance: TestInstance, text: Matcher, options?: MatcherOptions, waitForOptions?: WaitForOptions) => Promise<T>]; export { getInstanceError, wrapSingleQueryWithSuggestion, makeFindQuery, buildQueries, };