-
-
Notifications
You must be signed in to change notification settings - Fork 85
/
ctx.ts
49 lines (46 loc) · 1.1 KB
/
ctx.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
import { createCascade } from 'context';
import { assign, CB } from 'vest-utils';
import { Isolate, IsolateTypes } from 'IsolateTypes';
import { Modes } from 'Modes';
import VestTest from 'VestTest';
import type { StateRef } from 'createStateRef';
import { generateIsolate } from 'generateIsolate';
export default createCascade<CTXType>((ctxRef, parentContext) =>
parentContext
? null
: assign(
{
exclusion: {
tests: {},
groups: {},
},
inclusion: {},
isolate: generateIsolate(IsolateTypes.DEFAULT),
mode: [Modes.ALL],
},
ctxRef
)
);
type CTXType = {
isolate: Isolate;
stateRef?: StateRef;
exclusion: {
tests: Record<string, boolean>;
groups: Record<string, boolean>;
};
inclusion: Record<string, boolean | (() => boolean)>;
currentTest?: VestTest;
groupName?: string;
skipped?: boolean;
omitted?: boolean;
mode: [Modes];
bus?: {
on: (
event: string,
handler: CB
) => {
off: () => void;
};
emit: (event: string, ...args: any[]) => void;
};
};