-
-
Notifications
You must be signed in to change notification settings - Fork 269
/
index.ts
86 lines (80 loc) · 2.2 KB
/
index.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
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
/**
* Main export of the `@tapjs/core` module, providing the bulk of
* the internal machinery of tests.
*
* @module
*/
import { CallSiteLike, CallSiteLikeJSON } from '@tapjs/stack'
export * from './tap-file.js'
export * from './base.js'
export * from './counts.js'
export * from './extra-from-error.js'
export * from './lists.js'
export * from './main-script.js'
export * from './minimal.js'
export * from './normalize-message-extra.js'
export * from './parse-test-args.js'
export * from './proc.js'
export * from './spawn.js'
export * from './stdin.js'
export * from './tap-dir.js'
export * from './test-base.js'
export * from './test-point.js'
export * from './waiter.js'
export * from './worker.js'
// do it in this weird way to keep prettier from moving tap.js
// ahead of test-base.js. We need TestBase to be loaded
// and exported *before* tap, because TAP loades @tapjs/test, which
// extends TestBase.
export { tap, TAP }
import { tap, TAP } from './tap.js'
import type { TestBase, TestBaseOpts } from './test-base.js'
/**
* The `plugin` export from any tap plugin
*
* @template B - the return value of the plugin
* @template O - test options added by this plugin
*/
export type TapPlugin<
B extends Object,
O extends TestBaseOpts | any = unknown,
> =
unknown extends O ? (t: TestBase) => B : (t: TestBase, opts: O) => B
/**
* The extra info passed to assertions.
*
* Extended by BaseOpts, TestBaseOpts, and ultimately TestOpts, since any
* subtest is also an assertion, and can take all the same assertion options.
*/
export interface Extra {
bail?: boolean
todo?: string | boolean
skip?: string | boolean
at?: CallSiteLike | CallSiteLikeJSON | null
stack?: string
source?: string
errorOrigin?: {
at?: CallSiteLike | CallSiteLikeJSON | null
stack?: string
source?: string
}
found?: any
wanted?: any
doNotWant?: any
pattern?: any
diff?: string
message?: string
expired?: string
// error properties
type?: string
error?: any
diagnostic?: boolean
tapChildBuffer?: string
test?: string
[k: string]: any
}
/**
* The optional `..., message, extra)` arguments passed to
* test assertions.
*/
export type MessageExtra = [] | [string] | [Extra] | [string, Extra]