-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
51 lines (42 loc) · 1.19 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
declare module 'babel-test' {
import { TransformOptions } from '@babel/core';
type TransformCallback<T> = (code: string, options?: T) => { code: string };
type FixturesCallback = (
code: string,
options: { filename: string }
) => Promise<{ code: string }>;
type DoneCallback = {
(...args: any[]): any;
fail(error?: string | { message: string }): any;
};
type LifecycleCallback = (cb: DoneCallback) => any;
type FixturesOptions = {
beforeEach?: LifecycleCallback;
afterEach?: LifecycleCallback;
beforeAll?: LifecycleCallback;
afterAll?: LifecycleCallback;
};
type TestRunner<T> = (
title: string,
callback: (options: { transform: TransformCallback<T> }) => void
) => void;
type FixturesRunner = (
title: string,
directory: string,
options?: FixturesOptions,
callback?: FixturesCallback
) => void;
type Helpers<T> = {
test: TestRunner<T> & {
skip: TestRunner<T>;
only: TestRunner<T>;
};
fixtures: FixturesRunner & {
skip: FixturesRunner;
only: FixturesRunner;
};
};
export function create<T = TransformOptions>(
options: TransformOptions | TransformCallback<T>
): Helpers<T>;
}