// Minimum TypeScript Version: 4.0 /* eslint-disable @typescript-eslint/no-explicit-any */ import {VNodeChild} from 'vue' import {MountingOptions} from '@vue/test-utils' import {queries, EventType, BoundFunctions} from '@testing-library/dom' // eslint-disable-next-line import/no-extraneous-dependencies import {OptionsReceived as PrettyFormatOptions} from 'pretty-format' import {ComponentProps, ComponentSlots} from 'vue-component-type-helpers' import {RemoveIndexSignature} from 'type-fest' // NOTE: fireEvent is overridden below export * from '@testing-library/dom' export function cleanup(): void type Debug = ( baseElement?: Array | DocumentFragment | Element, maxLength?: number, options?: PrettyFormatOptions, ) => void export interface RenderResult extends BoundFunctions { container: Element baseElement: Element debug: Debug unmount(): void html(): string emitted(): Record emitted(name?: string): T[] rerender(props: object): Promise } type VueTestUtilsRenderOptions = Omit< MountingOptions>, 'attachTo' | 'propsData' | 'shallow' > interface VueTestingLibraryRenderOptions { /** * @deprecated Add a Vuex instance through `global.plugins` array instead. */ store?: any /** * @deprecated Add a Router instance through `global.plugins` array instead. */ routes?: any container?: Element baseElement?: Element } type AllowNonFunctionSlots = { [K in keyof Slots]: Slots[K] | VNodeChild } type ExtractSlots = AllowNonFunctionSlots< Partial>> > export interface RenderOptions extends Omit< VueTestingLibraryRenderOptions & VueTestUtilsRenderOptions, 'props' | 'slots' > { props?: ComponentProps slots?: ExtractSlots } export function render( TestComponent: C, options?: RenderOptions, ): RenderResult export type AsyncFireObject = { [K in EventType]: ( element: Document | Element | Window, options?: {}, ) => Promise } export interface VueFireEventObject extends AsyncFireObject { (element: Document | Element | Window, event: Event): Promise touch(element: Document | Element | Window): Promise update(element: HTMLOptionElement): Promise update( element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement, value: string, ): Promise update(element: Element, value?: string): Promise } export const fireEvent: VueFireEventObject