1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | export interface Options {
|
8 | verbose: boolean;
|
9 | }
|
10 |
|
11 | export interface HookRequireOptions extends Options {
|
12 | extensions: string[];
|
13 | postLoadHook(filename: string): void;
|
14 | }
|
15 |
|
16 | export function hookRequire(
|
17 | matcher: Matcher,
|
18 | transformer: Transformer,
|
19 | options?: Partial<HookRequireOptions>
|
20 | ): () => void;
|
21 |
|
22 | export function hookCreateScript(
|
23 | matcher: Matcher,
|
24 | transformer: Transformer,
|
25 | options?: Partial<Options>
|
26 | ): void;
|
27 |
|
28 | export function unhookCreateScript(): void;
|
29 |
|
30 | export function hookRunInThisContext(
|
31 | matcher: Matcher,
|
32 | transformer: Transformer,
|
33 | options?: Partial<Options>
|
34 | ): void;
|
35 |
|
36 | export function unhookRunInThisContext(): void;
|
37 |
|
38 | export function hookRunInContext(
|
39 | matcher: Matcher,
|
40 | transformer: Transformer,
|
41 | options?: Partial<HookRunInContextOptions>
|
42 | ): void;
|
43 |
|
44 | export function unhookRunInContext(): void;
|
45 |
|
46 | export function unloadRequireCache(matcher: Matcher): void;
|
47 |
|
48 | export type Matcher = (filename: string) => boolean;
|
49 | export type Transformer = (code: string, options: TransformerOptions) => string;
|
50 |
|
51 | export interface TransformerOptions {
|
52 | filename: string;
|
53 | }
|
54 |
|
55 | export interface HookRunInContextOptions extends Options {
|
56 | coverageVariable: string;
|
57 | }
|