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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
export type Fn = (assert: Assert) => Promise<void> | void;
export type TestFn = (name: string, fn?: Fn) => void;
export type EachFn = (assert: Assert, value: unknown) => Promise<void> | void;
export type TestEachFn = (name: string, data: DataInit, fn?: EachFn) => void;
export type TestOrEachFn = TestFn & { each: TestEachFn };
export type ModuleFn = (name: string, hooks?: Hooks | HooksFn, fn?: HooksFn) => void;
/**
* @link https://api.qunitjs.com/
*/
export type QUnit = {
start(): void;
config: {
[key: string]: unknown;
};
test: TestOrEachFn & {
skip: TestOrEachFn;
todo: TestOrEachFn;
only: TestOrEachFn;
};
skip: TestFn;
todo: TestFn;
only: TestFn;
module: ModuleFn & {
skip: ModuleFn;
todo: ModuleFn;
only: ModuleFn;
};
hooks: {
beforeEach(fn: Fn): void;
afterEach(fn: Fn): void;
};
assert: Assert;
begin(fn: UnknownFn): void;
done(fn: UnknownFn): void;
log(fn: UnknownFn): void;
moduleDone(fn: UnknownFn): void;
moduleStart(fn: UnknownFn): void;
on(fn: UnknownFn): void;
testDone(fn: UnknownFn): void;
testStart(fn: UnknownFn): void;
extend(target: unknown, mixin: unknown): unknown;
push(result: ResultInit): void;
stack(offset?: number): string;
onUncaughtException(fn: ErrorFn): void;
equiv(a: unknown, b: unknown): boolean;
dump: {
maxDepth: number;
parse(value: unknown): string;
};
};
/**
* @link https://api.qunitjs.com/QUnit/module/#options-object
*/
export type Hooks = {
before?: Fn;
beforeEach?: Fn;
after?: Fn;
afterEach?: Fn;
};
export type NestedHooks = {
before: (fn: Fn) => void;
beforeEach: (fn: Fn) => void;
after: (fn: Fn) => void;
afterEach: (fn: Fn) => void;
};
export type HooksFn = (hooks: NestedHooks) => void;
/**
* @link https://api.qunitjs.com/assert/
*/
export type Assert = {
async(count?: number): EmptyFn;
deepEqual(actual: unknown, expected: unknown, message?: string): void;
equal(actual: unknown, expected: unknown, message?: string): void;
expect(count: number): void;
false(actual: unknown, message?: string): void;
notDeepEqual(actual: unknown, expected: unknown, message?: string): void;
notEqual(actual: unknown, expected: unknown, message?: string): void;
notOk(actual: unknown, message?: string): void;
notPropContains(actual: unknown, prop: string, expected: unknown, message?: string): void;
notPropEqual(actual: unknown, prop: string, expected: unknown, message?: string): void;
notStrictEqual(actual: unknown, expected: unknown, message?: string): void;
ok(actual: unknown, message?: string): void;
propContains(actual: unknown, prop: string, expected: unknown, message?: string): void;
propEqual(actual: unknown, prop: string, expected: unknown, message?: string): void;
pushResult(result: ResultInit): void;
rejects(promise: Promise<unknown>, expected?: ErrorInit, message?: string): Promise<void>;
step(message: string): void;
strictEqual(actual: unknown, expected: unknown, message?: string): void;
throws(fn: () => unknown, expected?: ErrorInit, message?: string): void;
timeout(ms: number): void;
true(actual: unknown, message?: string): void;
verifySteps(steps: string[], message?: string): void;
};
export type ResultInit = {
result: boolean;
actual: unknown;
expected: unknown;
message?: string;
};
export type DataInit = unknown[] | Record<string, unknown>;
export type ErrorInit = Error | string | RegExp | ErrorConstructor;
export type EmptyFn = () => void;
export type ErrorFn = (error?: unknown) => void;
export type UnknownFn = (...args: unknown[]) => unknown;
|