52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
// Ambient test globals for optional *.test.* files in the editor / tsc.
|
|
// No test runner is installed in the template; stubs avoid spurious TS errors.
|
|
|
|
interface Matchers<R = void> {
|
|
toBeDefined(): R;
|
|
toBe(expected: unknown): R;
|
|
toEqual(expected: unknown): R;
|
|
toBeTruthy(): R;
|
|
toBeFalsy(): R;
|
|
toBeNull(): R;
|
|
toContain(item: unknown): R;
|
|
toHaveLength(length: number): R;
|
|
toMatch(expected: string | RegExp): R;
|
|
toThrow(expected?: string | RegExp | Error): R;
|
|
not: Matchers<R>;
|
|
}
|
|
|
|
interface Expect {
|
|
<T = unknown>(actual: T): Matchers;
|
|
}
|
|
|
|
declare const expect: Expect;
|
|
|
|
type TestCaseFn = (
|
|
name: string,
|
|
fn?: () => void | Promise<void>,
|
|
timeout?: number,
|
|
) => void;
|
|
|
|
declare const test: TestCaseFn;
|
|
declare const it: TestCaseFn;
|
|
declare const describe: TestCaseFn;
|
|
|
|
declare function beforeEach(fn: () => void | Promise<void>): void;
|
|
declare function afterEach(fn: () => void | Promise<void>): void;
|
|
declare function beforeAll(fn: () => void | Promise<void>): void;
|
|
declare function afterAll(fn: () => void | Promise<void>): void;
|
|
|
|
declare module "@testing-library/react" {
|
|
export function render(
|
|
ui: unknown,
|
|
options?: object,
|
|
): {
|
|
baseElement: Element;
|
|
container: Element;
|
|
unmount(): void;
|
|
rerender(ui: unknown): void;
|
|
};
|
|
export const screen: Record<string, (...args: unknown[]) => Element>;
|
|
export function cleanup(): void;
|
|
}
|