@c9up/helix 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +274 -5
- package/bin/helix.js +312 -13
- package/dist/cli/failed-cache.d.ts +27 -0
- package/dist/cli/failed-cache.d.ts.map +1 -0
- package/dist/cli/failed-cache.js +64 -0
- package/dist/cli/failed-cache.js.map +1 -0
- package/dist/cli/glob.d.ts +36 -0
- package/dist/cli/glob.d.ts.map +1 -0
- package/dist/cli/glob.js +193 -0
- package/dist/cli/glob.js.map +1 -0
- package/dist/cli/native.d.ts +4 -0
- package/dist/cli/native.d.ts.map +1 -1
- package/dist/cli/native.js.map +1 -1
- package/dist/cli/pool.d.ts +11 -0
- package/dist/cli/pool.d.ts.map +1 -1
- package/dist/cli/pool.js +13 -7
- package/dist/cli/pool.js.map +1 -1
- package/dist/cli/reporter.d.ts +11 -0
- package/dist/cli/reporter.d.ts.map +1 -1
- package/dist/cli/reporter.js +53 -0
- package/dist/cli/reporter.js.map +1 -1
- package/dist/cli/run.d.ts +41 -0
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +181 -21
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/runner.d.ts +19 -0
- package/dist/cli/runner.d.ts.map +1 -0
- package/dist/cli/runner.js +15 -0
- package/dist/cli/runner.js.map +1 -0
- package/dist/cli/suites.d.ts +102 -0
- package/dist/cli/suites.d.ts.map +1 -0
- package/dist/cli/suites.js +226 -0
- package/dist/cli/suites.js.map +1 -0
- package/dist/index.d.ts +10 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/japa/core.d.ts +106 -0
- package/dist/japa/core.d.ts.map +1 -0
- package/dist/japa/core.js +128 -0
- package/dist/japa/core.js.map +1 -0
- package/dist/runtime/assert.d.ts +174 -0
- package/dist/runtime/assert.d.ts.map +1 -0
- package/dist/runtime/assert.js +591 -0
- package/dist/runtime/assert.js.map +1 -0
- package/dist/runtime/asymmetric-brand.d.ts +20 -0
- package/dist/runtime/asymmetric-brand.d.ts.map +1 -0
- package/dist/runtime/asymmetric-brand.js +18 -0
- package/dist/runtime/asymmetric-brand.js.map +1 -0
- package/dist/runtime/asymmetric.d.ts +2 -10
- package/dist/runtime/asymmetric.d.ts.map +1 -1
- package/dist/runtime/asymmetric.js +3 -7
- package/dist/runtime/asymmetric.js.map +1 -1
- package/dist/runtime/bootstrap.d.ts +47 -0
- package/dist/runtime/bootstrap.d.ts.map +1 -0
- package/dist/runtime/bootstrap.js +166 -0
- package/dist/runtime/bootstrap.js.map +1 -0
- package/dist/runtime/cli-args.d.ts +77 -0
- package/dist/runtime/cli-args.d.ts.map +1 -0
- package/dist/runtime/cli-args.js +85 -0
- package/dist/runtime/cli-args.js.map +1 -0
- package/dist/runtime/cli-worker.js +1 -2
- package/dist/runtime/cli-worker.js.map +1 -1
- package/dist/runtime/configure.d.ts +214 -0
- package/dist/runtime/configure.d.ts.map +1 -0
- package/dist/runtime/configure.js +164 -0
- package/dist/runtime/configure.js.map +1 -0
- package/dist/runtime/context.d.ts +84 -0
- package/dist/runtime/context.d.ts.map +1 -0
- package/dist/runtime/context.js +146 -0
- package/dist/runtime/context.js.map +1 -0
- package/dist/runtime/emitter.d.ts +141 -0
- package/dist/runtime/emitter.d.ts.map +1 -0
- package/dist/runtime/emitter.js +79 -0
- package/dist/runtime/emitter.js.map +1 -0
- package/dist/runtime/equals.d.ts.map +1 -1
- package/dist/runtime/equals.js +6 -10
- package/dist/runtime/equals.js.map +1 -1
- package/dist/runtime/global-hooks.d.ts +31 -0
- package/dist/runtime/global-hooks.d.ts.map +1 -0
- package/dist/runtime/global-hooks.js +126 -0
- package/dist/runtime/global-hooks.js.map +1 -0
- package/dist/runtime/index.d.ts +14 -3
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +7 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/ipc-protocol.d.ts +21 -0
- package/dist/runtime/ipc-protocol.d.ts.map +1 -0
- package/dist/runtime/ipc-protocol.js +21 -0
- package/dist/runtime/ipc-protocol.js.map +1 -0
- package/dist/runtime/run.d.ts +49 -2
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +618 -94
- package/dist/runtime/run.js.map +1 -1
- package/dist/runtime/runner.d.ts +97 -0
- package/dist/runtime/runner.d.ts.map +1 -0
- package/dist/runtime/runner.js +160 -0
- package/dist/runtime/runner.js.map +1 -0
- package/dist/runtime/suite-config.d.ts +23 -0
- package/dist/runtime/suite-config.d.ts.map +1 -0
- package/dist/runtime/suite-config.js +52 -0
- package/dist/runtime/suite-config.js.map +1 -0
- package/dist/runtime/suite-taps.d.ts +122 -0
- package/dist/runtime/suite-taps.d.ts.map +1 -0
- package/dist/runtime/suite-taps.js +218 -0
- package/dist/runtime/suite-taps.js.map +1 -0
- package/dist/runtime/suite.d.ts +277 -8
- package/dist/runtime/suite.d.ts.map +1 -1
- package/dist/runtime/suite.js +255 -4
- package/dist/runtime/suite.js.map +1 -1
- package/dist/runtime/test-context.d.ts +50 -3
- package/dist/runtime/test-context.d.ts.map +1 -1
- package/dist/runtime/test-context.js +83 -5
- package/dist/runtime/test-context.js.map +1 -1
- package/dist/runtime/worker.d.ts.map +1 -1
- package/dist/runtime/worker.js +86 -29
- package/dist/runtime/worker.js.map +1 -1
- package/index.darwin-arm64.node +0 -0
- package/index.darwin-x64.node +0 -0
- package/index.linux-arm64-gnu.node +0 -0
- package/index.linux-x64-gnu.node +0 -0
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +8 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `suite.onTest()` / `suite.onGroup()` — the taps Japa's `Suite` exposes to
|
|
3
|
+
* `configureSuite`, so a bootstrap can configure every test or group of a suite
|
|
4
|
+
* without touching the test files.
|
|
5
|
+
*
|
|
6
|
+
* export const configureSuite = (suite) => {
|
|
7
|
+
* if (suite.name === "e2e") suite.onTest((test) => test.timeout(30_000))
|
|
8
|
+
* }
|
|
9
|
+
*
|
|
10
|
+
* `configureSuite` runs before the test file is imported, so the callbacks are
|
|
11
|
+
* stored and applied to the collected tree just before execution — the same
|
|
12
|
+
* point at which Japa's taps fire (each test, once, before it runs).
|
|
13
|
+
*
|
|
14
|
+
* Each method maps onto a field the collection tree already carries; nothing
|
|
15
|
+
* here is a facade over behaviour helix does not have. Japa `Test` members that
|
|
16
|
+
* belong to EXECUTION rather than configuration — `run`, `exec`, `context`,
|
|
17
|
+
* `executed`, `failed`, `options` — are absent: helix owns execution, and a
|
|
18
|
+
* handle that pretended otherwise would be lying about what a callback can do.
|
|
19
|
+
*/
|
|
20
|
+
export function testHandle(node) {
|
|
21
|
+
const handle = {
|
|
22
|
+
get title() {
|
|
23
|
+
return node.name;
|
|
24
|
+
},
|
|
25
|
+
skip(skip = true, reason) {
|
|
26
|
+
if (typeof skip === "function")
|
|
27
|
+
node.skipCondition = skip;
|
|
28
|
+
else
|
|
29
|
+
node.mode = skip ? "skip" : "run";
|
|
30
|
+
if (reason !== undefined)
|
|
31
|
+
node.reason = reason;
|
|
32
|
+
return handle;
|
|
33
|
+
},
|
|
34
|
+
fails(reason) {
|
|
35
|
+
node.failing = true;
|
|
36
|
+
if (reason !== undefined)
|
|
37
|
+
node.reason = reason;
|
|
38
|
+
return handle;
|
|
39
|
+
},
|
|
40
|
+
timeout(ms) {
|
|
41
|
+
node.timeoutMs = ms;
|
|
42
|
+
return handle;
|
|
43
|
+
},
|
|
44
|
+
disableTimeout() {
|
|
45
|
+
node.timeoutMs = 0;
|
|
46
|
+
return handle;
|
|
47
|
+
},
|
|
48
|
+
resetTimeout(ms) {
|
|
49
|
+
node.timeoutMs = ms ?? 0;
|
|
50
|
+
return handle;
|
|
51
|
+
},
|
|
52
|
+
tags(tags, strategy = "replace") {
|
|
53
|
+
const current = node.tags ?? [];
|
|
54
|
+
node.tags =
|
|
55
|
+
strategy === "append"
|
|
56
|
+
? [...current, ...tags]
|
|
57
|
+
: strategy === "prepend"
|
|
58
|
+
? [...tags, ...current]
|
|
59
|
+
: [...tags];
|
|
60
|
+
return handle;
|
|
61
|
+
},
|
|
62
|
+
retry(retries) {
|
|
63
|
+
node.retries = retries;
|
|
64
|
+
return handle;
|
|
65
|
+
},
|
|
66
|
+
waitForDone() {
|
|
67
|
+
node.waitForDone = true;
|
|
68
|
+
return handle;
|
|
69
|
+
},
|
|
70
|
+
pin() {
|
|
71
|
+
node.pinned = true;
|
|
72
|
+
return handle;
|
|
73
|
+
},
|
|
74
|
+
setup(fn) {
|
|
75
|
+
node.setups ??= [];
|
|
76
|
+
node.setups.push(fn);
|
|
77
|
+
return handle;
|
|
78
|
+
},
|
|
79
|
+
teardown(fn) {
|
|
80
|
+
node.teardowns ??= [];
|
|
81
|
+
node.teardowns.push(fn);
|
|
82
|
+
return handle;
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
return handle;
|
|
86
|
+
}
|
|
87
|
+
export function groupHandle(node) {
|
|
88
|
+
const handle = {
|
|
89
|
+
get title() {
|
|
90
|
+
return node.name;
|
|
91
|
+
},
|
|
92
|
+
tap(callback) {
|
|
93
|
+
for (const child of node.children) {
|
|
94
|
+
if (child.kind === "test")
|
|
95
|
+
callback(testHandle(child));
|
|
96
|
+
}
|
|
97
|
+
return handle;
|
|
98
|
+
},
|
|
99
|
+
setup(fn) {
|
|
100
|
+
node.hooks.push({ type: "beforeAll", fn });
|
|
101
|
+
return handle;
|
|
102
|
+
},
|
|
103
|
+
teardown(fn) {
|
|
104
|
+
node.hooks.push({ type: "afterAll", fn });
|
|
105
|
+
return handle;
|
|
106
|
+
},
|
|
107
|
+
each: {
|
|
108
|
+
setup(fn) {
|
|
109
|
+
node.hooks.push({ type: "beforeEach", fn });
|
|
110
|
+
},
|
|
111
|
+
teardown(fn) {
|
|
112
|
+
node.hooks.push({ type: "afterEach", fn });
|
|
113
|
+
},
|
|
114
|
+
timeout(ms) {
|
|
115
|
+
node.eachTimeout = ms;
|
|
116
|
+
},
|
|
117
|
+
retry(retries) {
|
|
118
|
+
node.eachRetries = retries;
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
return handle;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* A handle whose `setup`/`teardown` append to the given arrays — the caller
|
|
126
|
+
* owns when those hooks run, so the same handle serves the bootstrap's
|
|
127
|
+
* `configureSuite` and a plugin's `runner.onSuite`.
|
|
128
|
+
*/
|
|
129
|
+
export function makeSuiteHandle(name, setup, teardown) {
|
|
130
|
+
const handle = {
|
|
131
|
+
name,
|
|
132
|
+
setup(fn) {
|
|
133
|
+
setup.push(fn);
|
|
134
|
+
return handle;
|
|
135
|
+
},
|
|
136
|
+
teardown(fn) {
|
|
137
|
+
teardown.push(fn);
|
|
138
|
+
return handle;
|
|
139
|
+
},
|
|
140
|
+
onTest(callback) {
|
|
141
|
+
registerTestTap(callback);
|
|
142
|
+
return handle;
|
|
143
|
+
},
|
|
144
|
+
onGroup(callback) {
|
|
145
|
+
registerGroupTap(callback);
|
|
146
|
+
return handle;
|
|
147
|
+
},
|
|
148
|
+
bail(toggle = true) {
|
|
149
|
+
setBail(toggle);
|
|
150
|
+
return handle;
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
return handle;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The suite the current `configure()` call is running for. Set before plugins
|
|
157
|
+
* run so `runner.onSuite` has something to hand back — a worker runs exactly
|
|
158
|
+
* one suite, so Japa's "called once per suite" is "called once".
|
|
159
|
+
*/
|
|
160
|
+
let current;
|
|
161
|
+
export function setCurrentSuite(handle) {
|
|
162
|
+
current = handle;
|
|
163
|
+
}
|
|
164
|
+
export function currentSuite() {
|
|
165
|
+
return current;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Callbacks registered before the file is imported (`configureSuite`, and a
|
|
169
|
+
* plugin reaching for `runner.bail`), applied once the tree exists. Process-wide,
|
|
170
|
+
* like the rest of the bootstrap state.
|
|
171
|
+
*/
|
|
172
|
+
const taps = { onTest: [], onGroup: [] };
|
|
173
|
+
/** Register a per-test tap (Japa `Suite#onTest`). */
|
|
174
|
+
export function registerTestTap(callback) {
|
|
175
|
+
taps.onTest.push(callback);
|
|
176
|
+
}
|
|
177
|
+
/** Register a per-group tap (Japa `Suite#onGroup`). */
|
|
178
|
+
export function registerGroupTap(callback) {
|
|
179
|
+
taps.onGroup.push(callback);
|
|
180
|
+
}
|
|
181
|
+
/** Ask this suite to stop at the first failure (Japa `Suite#bail`). */
|
|
182
|
+
export function setBail(toggle) {
|
|
183
|
+
taps.bail = toggle;
|
|
184
|
+
}
|
|
185
|
+
/** Whether a tap asked for bail; `undefined` leaves the CLI flag in charge. */
|
|
186
|
+
export function tappedBail() {
|
|
187
|
+
return taps.bail;
|
|
188
|
+
}
|
|
189
|
+
/** Test seam: drop every registered tap. */
|
|
190
|
+
export function resetTaps() {
|
|
191
|
+
taps.onTest.length = 0;
|
|
192
|
+
taps.onGroup.length = 0;
|
|
193
|
+
taps.bail = undefined;
|
|
194
|
+
current = undefined;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Walk the collected tree, handing every test to the `onTest` taps and every
|
|
198
|
+
* group to the `onGroup` ones. Depth-first in declaration order, so a tap sees
|
|
199
|
+
* the tests in the order they will run.
|
|
200
|
+
*/
|
|
201
|
+
export function applyTaps(root) {
|
|
202
|
+
if (taps.onTest.length === 0 && taps.onGroup.length === 0)
|
|
203
|
+
return;
|
|
204
|
+
const walk = (node) => {
|
|
205
|
+
for (const child of node.children) {
|
|
206
|
+
if (child.kind === "test") {
|
|
207
|
+
for (const callback of taps.onTest)
|
|
208
|
+
callback(testHandle(child));
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
for (const callback of taps.onGroup)
|
|
212
|
+
callback(groupHandle(child));
|
|
213
|
+
walk(child);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
walk(root);
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=suite-taps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suite-taps.js","sourceRoot":"","sources":["../../src/runtime/suite-taps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAgDH,MAAM,UAAU,UAAU,CAAC,IAAc;IACxC,MAAM,MAAM,GAAe;QAC1B,IAAI,KAAK;YACR,OAAO,IAAI,CAAC,IAAI,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,MAAM;YACvB,IAAI,OAAO,IAAI,KAAK,UAAU;gBAAE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;;gBACrD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;YACvC,IAAI,MAAM,KAAK,SAAS;gBAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YAC/C,OAAO,MAAM,CAAC;QACf,CAAC;QACD,KAAK,CAAC,MAAM;YACX,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAI,MAAM,KAAK,SAAS;gBAAE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YAC/C,OAAO,MAAM,CAAC;QACf,CAAC;QACD,OAAO,CAAC,EAAE;YACT,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;YACpB,OAAO,MAAM,CAAC;QACf,CAAC;QACD,cAAc;YACb,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;YACnB,OAAO,MAAM,CAAC;QACf,CAAC;QACD,YAAY,CAAC,EAAE;YACd,IAAI,CAAC,SAAS,GAAG,EAAE,IAAI,CAAC,CAAC;YACzB,OAAO,MAAM,CAAC;QACf,CAAC;QACD,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS;YAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,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IACtB,OAAO,GAAG,SAAS,CAAC;AACrB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAAe;IACxC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAClE,MAAM,IAAI,GAAG,CAAC,IAAe,EAAQ,EAAE;QACtC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;gBAC3B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,MAAM;oBAAE,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;gBAChE,SAAS;YACV,CAAC;YACD,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,OAAO;gBAAE,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;YAClE,IAAI,CAAC,KAAK,CAAC,CAAC;QACb,CAAC;IACF,CAAC,CAAC;IACF,IAAI,CAAC,IAAI,CAAC,CAAC;AACZ,CAAC"}
|
package/dist/runtime/suite.d.ts
CHANGED
|
@@ -7,12 +7,32 @@
|
|
|
7
7
|
* invocations never share state.
|
|
8
8
|
*/
|
|
9
9
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
10
|
-
|
|
10
|
+
import type { TestContext } from "./context.js";
|
|
11
|
+
import { type TestCleanup } from "./test-context.js";
|
|
12
|
+
/**
|
|
13
|
+
* Signals completion of a `waitForDone()` test. Call `done()` to pass, or
|
|
14
|
+
* `done(error)` to fail (Japa parity). Ignored unless `test.waitForDone()`.
|
|
15
|
+
*/
|
|
16
|
+
export type DoneFn = (error?: unknown) => void;
|
|
17
|
+
/**
|
|
18
|
+
* A test body. Receives the injected {@link TestContext} as its first argument
|
|
19
|
+
* and a `done` callback as its second (Japa parity). Existing zero/one-argument
|
|
20
|
+
* bodies stay valid — they simply ignore the extra parameters.
|
|
21
|
+
*/
|
|
22
|
+
export type TestFn = (ctx: TestContext, done: DoneFn) => void | Promise<void>;
|
|
11
23
|
export type SuiteFn = () => void;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Teardown a hook may return (Vitest/Japa parity). Receives `(hasError, subject)`
|
|
26
|
+
* — whether the test/group errored, and the Test or Group instance. Both params
|
|
27
|
+
* are optional so plain `() => …` cleanups stay valid.
|
|
28
|
+
*/
|
|
29
|
+
export type CleanupFn = (hasError?: boolean, subject?: TestInstance | GroupInstance) => void | Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* A lifecycle hook. Receives the Test instance (test hooks) or Group instance
|
|
32
|
+
* (group hooks) as its argument (Japa parity); may return a {@link CleanupFn}.
|
|
33
|
+
* Existing zero-argument hooks stay valid.
|
|
34
|
+
*/
|
|
35
|
+
export type HookFn = ((subject?: TestInstance | GroupInstance) => void | Promise<void>) | ((subject?: TestInstance | GroupInstance) => CleanupFn | Promise<CleanupFn>);
|
|
16
36
|
export type HookType = "beforeAll" | "afterAll" | "beforeEach" | "afterEach";
|
|
17
37
|
export interface Hook {
|
|
18
38
|
type: HookType;
|
|
@@ -34,6 +54,98 @@ export interface TestNode {
|
|
|
34
54
|
tags?: string[];
|
|
35
55
|
/** When `true`, the test is expected to throw — `test.fails()`. */
|
|
36
56
|
failing?: boolean;
|
|
57
|
+
/** Reason attached to `test.fails(reason)` / `test.skip(cond, reason)`. */
|
|
58
|
+
reason?: string;
|
|
59
|
+
/** Marked via `test.pin()` — reported as pinned; runs like `.only`. */
|
|
60
|
+
pinned?: boolean;
|
|
61
|
+
/** Per-test setup hooks — `test.setup(fn)` (run just before this test). */
|
|
62
|
+
setups?: HookFn[];
|
|
63
|
+
/** Per-test teardown hooks — `test.teardown(fn)` (run just after this test). */
|
|
64
|
+
teardowns?: HookFn[];
|
|
65
|
+
/** Resolved dataset rows backing this test — `test(name, fn).with(rows)` (Japa `ctx.test.dataset`). */
|
|
66
|
+
dataset?: readonly unknown[];
|
|
67
|
+
/**
|
|
68
|
+
* Deferred dataset source — `test(name, fn).with(rows)`. An array OR a
|
|
69
|
+
* (possibly async) function returning one (Japa parity). Resolved at RUN time
|
|
70
|
+
* so async datasets work; the node then expands into one result per row.
|
|
71
|
+
*/
|
|
72
|
+
datasetFn?: DatasetSource<unknown>;
|
|
73
|
+
/**
|
|
74
|
+
* The dataset test body — receives `(ctx, row)`. Set by `.with().run()` or
|
|
75
|
+
* re-homed from `test(name, fn).with()`. Declared as a METHOD signature so its
|
|
76
|
+
* `row` param is bivariant: a caller's `(ctx, row: Row) => …` assigns here
|
|
77
|
+
* without a cast (the type-erasure boundary between the generic `.with<Row>`
|
|
78
|
+
* surface and this untyped node storage).
|
|
79
|
+
*/
|
|
80
|
+
datasetBody?(ctx: TestContext, row: unknown): void | Promise<void>;
|
|
81
|
+
/** Wait for the `done()` callback before completing — `test.waitForDone()`. */
|
|
82
|
+
waitForDone?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Deferred skip condition — `test.skip(fn)` where `fn` may be async (Japa
|
|
85
|
+
* parity). Evaluated at RUN time. A static boolean sets `mode` at collection
|
|
86
|
+
* instead, so this only ever holds a function.
|
|
87
|
+
*/
|
|
88
|
+
skipCondition?: () => boolean | Promise<boolean>;
|
|
89
|
+
}
|
|
90
|
+
/** A group's instance, passed to `group.setup`/`teardown` hooks (Japa parity). */
|
|
91
|
+
export interface GroupInstance {
|
|
92
|
+
/** The group's own name. */
|
|
93
|
+
title: string;
|
|
94
|
+
/** Fully-qualified dotted name (suite path). */
|
|
95
|
+
fullName: string;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The running test's own instance, injected as `ctx.test` (Japa parity). Read
|
|
99
|
+
* access to the test's identity + resolved options + dataset.
|
|
100
|
+
*/
|
|
101
|
+
export interface TestInstance {
|
|
102
|
+
/** The test's own name (leaf). */
|
|
103
|
+
title: string;
|
|
104
|
+
/** Fully-qualified dotted name (suite path + title). */
|
|
105
|
+
fullName: string;
|
|
106
|
+
/** Resolved options in effect for this run (Japa `test.options` parity). */
|
|
107
|
+
options: {
|
|
108
|
+
/** The test's title (leaf name). */
|
|
109
|
+
title: string;
|
|
110
|
+
timeout: number;
|
|
111
|
+
retries: number;
|
|
112
|
+
tags: readonly string[];
|
|
113
|
+
/** Whether this is a `todo` test. Always `false` inside a running test. */
|
|
114
|
+
isTodo: boolean;
|
|
115
|
+
/** Whether the test is expected to throw — `test.fails()` (Japa parity). */
|
|
116
|
+
isFailing: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Free-form metadata bag (Japa `options.meta`): `fileName`, `group` (the
|
|
119
|
+
* enclosing {@link Group} instance, or `undefined` outside a group),
|
|
120
|
+
* `suite` (`{ name }` — `"default"` unless `configure({ suite })` or
|
|
121
|
+
* `--suite` names it, exactly like Japa's implicit suite), and `abort`.
|
|
122
|
+
*/
|
|
123
|
+
meta: Record<string, unknown>;
|
|
124
|
+
};
|
|
125
|
+
/** The full dataset when created via `test(name, fn).with(rows)`, else undefined. */
|
|
126
|
+
dataset?: readonly unknown[];
|
|
127
|
+
/**
|
|
128
|
+
* The injected {@link TestContext} for this run — Japa's `$test.context`. Set
|
|
129
|
+
* before the `beforeEach` chain, so lifecycle hooks can reach it; the same
|
|
130
|
+
* context is passed to the test body as its first argument. Undefined only
|
|
131
|
+
* outside an active run.
|
|
132
|
+
*/
|
|
133
|
+
context?: TestContext;
|
|
134
|
+
/** Whether the test was pinned via `test.pin()`. */
|
|
135
|
+
isPinned: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Re-arm the running test's timeout (Japa `ctx.test.resetTimeout`). With no
|
|
138
|
+
* argument, restarts the current timeout; with `ms`, sets a new one. Useful
|
|
139
|
+
* for long polling steps that shouldn't count against a single deadline.
|
|
140
|
+
*/
|
|
141
|
+
resetTimeout(ms?: number): void;
|
|
142
|
+
/**
|
|
143
|
+
* Register a teardown that runs at the end of THIS test regardless of outcome
|
|
144
|
+
* (Japa `test.cleanup`). This is the same registry as `ctx.cleanup`; it is
|
|
145
|
+
* exposed here so a resource macro's `t` (see `test.macro`) can register
|
|
146
|
+
* cleanups — `test.macro((t) => { t.cleanup(() => …) })`.
|
|
147
|
+
*/
|
|
148
|
+
cleanup(fn: TestCleanup): void;
|
|
37
149
|
}
|
|
38
150
|
/** Vitest-style per-test options (3rd argument to `test`). */
|
|
39
151
|
export interface TestOptions {
|
|
@@ -51,12 +163,57 @@ export interface TestOptions {
|
|
|
51
163
|
* mutate the just-registered node. Ignoring the return keeps Vitest's
|
|
52
164
|
* `test(name, fn)` ergonomics; chaining adds `@japa/runner` parity.
|
|
53
165
|
*/
|
|
166
|
+
/** How `tags()` merges with any tags already on the test (Japa parity). */
|
|
167
|
+
export type TagStrategy = "replace" | "append" | "prepend";
|
|
54
168
|
export interface TestHandle {
|
|
55
169
|
retry(n: number): TestHandle;
|
|
56
170
|
timeout(ms: number): TestHandle;
|
|
57
171
|
disableTimeout(): TestHandle;
|
|
58
|
-
|
|
59
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Attach tags. Japa parity: `tags(['@slow'], 'append')`. `strategy` defaults
|
|
174
|
+
* to `'replace'`. A single string is accepted as a shorthand.
|
|
175
|
+
*/
|
|
176
|
+
tags(tags: string | string[], strategy?: TagStrategy): TestHandle;
|
|
177
|
+
/** Expect the test to throw. Optional `reason` documents why (Japa parity). */
|
|
178
|
+
fails(reason?: string): TestHandle;
|
|
179
|
+
/** Run a hook just before THIS test (Japa `test.setup`). */
|
|
180
|
+
setup(fn: HookFn): TestHandle;
|
|
181
|
+
/** Run a hook just after THIS test (Japa `test.teardown`). */
|
|
182
|
+
teardown(fn: HookFn): TestHandle;
|
|
183
|
+
/** Pin the test: when any test is pinned, only pinned tests run (Japa `test.pin`). */
|
|
184
|
+
pin(): TestHandle;
|
|
185
|
+
/**
|
|
186
|
+
* Skip the test, optionally only when `condition` (a boolean OR a function
|
|
187
|
+
* returning one — which may be async, Japa parity) is true, with a `reason`.
|
|
188
|
+
* A function condition is evaluated at RUN time, not at collection.
|
|
189
|
+
*/
|
|
190
|
+
skip(condition?: boolean | (() => boolean | Promise<boolean>), reason?: string): TestHandle;
|
|
191
|
+
/** Complete only once the body calls its `done` callback (Japa `waitForDone`). */
|
|
192
|
+
waitForDone(): TestHandle;
|
|
193
|
+
/**
|
|
194
|
+
* Attach a dataset (Japa parity). Two forms:
|
|
195
|
+
* - `test('title', (ctx, row) => …).with([...])` — the body from `test()`
|
|
196
|
+
* is re-homed and runs once per row (row typed as the 2nd body arg).
|
|
197
|
+
* - `test('title').with([...]).run((ctx, row) => …)` — the fully-typed
|
|
198
|
+
* form; `row` is inferred as the dataset element type.
|
|
199
|
+
* `rows` may be an array OR a (possibly async) function returning one,
|
|
200
|
+
* resolved at run time. Title tokens: `{prop}` (object rows), `{$i}`
|
|
201
|
+
* (1-based index), `{$self}` (the row itself).
|
|
202
|
+
*/
|
|
203
|
+
with<Row>(rows: DatasetSource<Row>): DatasetHandle<Row>;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* The handle returned by `test(...).with(rows)` — carries the dataset element
|
|
207
|
+
* type so `.run((ctx, row) => …)` types `row` precisely (Japa parity).
|
|
208
|
+
*/
|
|
209
|
+
export interface DatasetHandle<Row> {
|
|
210
|
+
/**
|
|
211
|
+
* Provide the per-row body when `test('title')` had none —
|
|
212
|
+
* `test('title').with([...]).run((ctx, row) => …)`. Takes only the body (no
|
|
213
|
+
* name); the name came from `test()`. Returns the base handle for further
|
|
214
|
+
* chaining.
|
|
215
|
+
*/
|
|
216
|
+
run(fn: (ctx: TestContext, row: Row) => void | Promise<void>): TestHandle;
|
|
60
217
|
}
|
|
61
218
|
export interface SuiteNode {
|
|
62
219
|
kind: "suite";
|
|
@@ -65,6 +222,18 @@ export interface SuiteNode {
|
|
|
65
222
|
parent: SuiteNode | undefined;
|
|
66
223
|
children: Array<SuiteNode | TestNode>;
|
|
67
224
|
hooks: Hook[];
|
|
225
|
+
/** Default per-test timeout for tests in this group — `group.each.timeout(ms)`. */
|
|
226
|
+
eachTimeout?: number;
|
|
227
|
+
/** Default per-test retries for tests in this group — `group.each.retry(n)`. */
|
|
228
|
+
eachRetries?: number;
|
|
229
|
+
/** Opened via `test.group()` (vs `describe`) — Japa forbids nesting these. */
|
|
230
|
+
isGroup?: boolean;
|
|
231
|
+
/**
|
|
232
|
+
* The single {@link Group} instance built by `test.group()` for this node —
|
|
233
|
+
* the body handle, the value returned, AND the `self` its hooks receive
|
|
234
|
+
* (Japa `self === group`). Absent on plain `describe` suites.
|
|
235
|
+
*/
|
|
236
|
+
groupInstance?: Group;
|
|
68
237
|
}
|
|
69
238
|
interface CollectionContext {
|
|
70
239
|
root: SuiteNode;
|
|
@@ -109,12 +278,112 @@ type ObjectRow = Readonly<Record<string, unknown>>;
|
|
|
109
278
|
type EachRow = ArrayRow | ObjectRow | null | undefined | string | number | boolean | bigint | symbol;
|
|
110
279
|
/** Source of `each` rows: a static array or a (sync) function returning one. */
|
|
111
280
|
type EachRows<Row extends EachRow> = readonly Row[] | (() => readonly Row[]);
|
|
281
|
+
/**
|
|
282
|
+
* Source of dataset rows (`test(name, fn).with(...)`): a static array OR a
|
|
283
|
+
* function returning one — the function may be async (Japa parity). Resolved at
|
|
284
|
+
* RUN time so async sources work.
|
|
285
|
+
*/
|
|
286
|
+
export type DatasetSource<Row> = readonly Row[] | (() => readonly Row[] | Promise<readonly Row[]>);
|
|
287
|
+
/**
|
|
288
|
+
* The `group` handle passed to `test.group(name, (group) => …)` (Japa parity).
|
|
289
|
+
* `setup`/`teardown` run once for the whole group; `each.setup`/`each.teardown`
|
|
290
|
+
* run around every test in it. Hook bodies may return a cleanup function.
|
|
291
|
+
*/
|
|
292
|
+
export interface Group extends GroupInstance {
|
|
293
|
+
/** Run once before all tests in the group (≈ `beforeAll`). */
|
|
294
|
+
setup(fn: HookFn): void;
|
|
295
|
+
/** Run once after all tests in the group (≈ `afterAll`). */
|
|
296
|
+
teardown(fn: HookFn): void;
|
|
297
|
+
/** Per-test hooks + defaults for this group (≈ `beforeEach`/`afterEach`). */
|
|
298
|
+
each: {
|
|
299
|
+
setup(fn: HookFn): void;
|
|
300
|
+
teardown(fn: HookFn): void;
|
|
301
|
+
/** Default timeout (ms) for every test in the group — `group.each.timeout(ms)`. */
|
|
302
|
+
timeout(ms: number): void;
|
|
303
|
+
/** Disable the timeout for every test in the group. */
|
|
304
|
+
disableTimeout(): void;
|
|
305
|
+
/** Default retries for every test in the group — `group.each.retry(n)`. */
|
|
306
|
+
retry(n: number): void;
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Configure every test in the group — `group.tap(t => t.tags('@slow'))` or
|
|
310
|
+
* `group.tap(t => { t.options.title = t.options.title.toUpperCase() })`.
|
|
311
|
+
* Applied to all tests registered in the group body. The callback receives a
|
|
312
|
+
* {@link TapHandle}: the chainable modifiers PLUS a mutable `options` view
|
|
313
|
+
* (Japa `test.options.title` parity).
|
|
314
|
+
*/
|
|
315
|
+
tap(fn: (test: TapHandle) => void): void;
|
|
316
|
+
}
|
|
317
|
+
/** The mutable, resolved options of a test, exposed to `group.tap` (Japa parity). */
|
|
318
|
+
export interface TapOptions {
|
|
319
|
+
/** The test's title — assignable to rename it (Japa `test.options.title`). */
|
|
320
|
+
title: string;
|
|
321
|
+
/** The test's tags — assignable to replace them. */
|
|
322
|
+
tags: string[];
|
|
323
|
+
/** Per-test timeout in ms (`undefined` = inherit). */
|
|
324
|
+
timeout: number | undefined;
|
|
325
|
+
/** Extra attempts on failure (`undefined` = inherit). */
|
|
326
|
+
retries: number | undefined;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* The handle passed to `group.tap` — a {@link TestHandle} (chainable modifiers)
|
|
330
|
+
* augmented with a mutable {@link TapOptions} view, matching Japa's `test`
|
|
331
|
+
* instance whose `options` are directly assignable.
|
|
332
|
+
*/
|
|
333
|
+
export interface TapHandle extends TestHandle {
|
|
334
|
+
readonly options: TapOptions;
|
|
335
|
+
}
|
|
112
336
|
type TestApi = {
|
|
113
|
-
|
|
337
|
+
/**
|
|
338
|
+
* Register a test. Omitting `fn` marks it `todo` (Japa parity) — reported as
|
|
339
|
+
* pending and never executed — unless a dataset body is supplied later via
|
|
340
|
+
* `.with(...).run(fn)`.
|
|
341
|
+
*/
|
|
342
|
+
(name: string, fn?: TestFn, options?: TestOptions | number): TestHandle;
|
|
114
343
|
skip(name: string, fn?: TestFn): void;
|
|
115
344
|
only(name: string, fn: TestFn, options?: TestOptions | number): TestHandle;
|
|
116
345
|
todo(name: string): void;
|
|
117
346
|
each<Row extends EachRow>(rows: EachRows<Row>): (name: string, fn: (row: Row) => void | Promise<void>) => void;
|
|
347
|
+
/**
|
|
348
|
+
* Japa-style grouping: `test.group(name, (group) => { … })`. Returns the
|
|
349
|
+
* {@link Group} — the SAME instance passed to the body and to the group's
|
|
350
|
+
* hooks as `self` (Japa's current release returns the group; `self === group`).
|
|
351
|
+
*/
|
|
352
|
+
group(name: string, fn: (group: Group) => void): Group;
|
|
353
|
+
/**
|
|
354
|
+
* Create a resource macro (Japa `test.macro`). The callback receives the
|
|
355
|
+
* running test instance `t` (carrying `t.cleanup`) followed by any arguments;
|
|
356
|
+
* `macro` returns a function that, called inside a test body, invokes the
|
|
357
|
+
* callback against the active test and returns its value:
|
|
358
|
+
*
|
|
359
|
+
* const useFile = test.macro((t, path: string) => {
|
|
360
|
+
* t.cleanup(() => rm(path))
|
|
361
|
+
* return writeFile(path, '…')
|
|
362
|
+
* })
|
|
363
|
+
* // inside a test: await useFile('tmp/a.txt')
|
|
364
|
+
*
|
|
365
|
+
* To add a chainable method to every handle instead, use {@link Test.macro}.
|
|
366
|
+
*/
|
|
367
|
+
macro<Args extends unknown[], R>(callback: (test: TestInstance, ...args: Args) => R): (...args: Args) => R;
|
|
368
|
+
};
|
|
369
|
+
/**
|
|
370
|
+
* Interpolate a dataset test title (Japa parity). Tokens:
|
|
371
|
+
* - `{$i}` → the 1-based row index
|
|
372
|
+
* - `{$self}`→ the row itself (stringified) — for primitive/array rows
|
|
373
|
+
* - `{prop}` / `{a.b}` → a (dotted) property lookup on an object row
|
|
374
|
+
* Unknown `{tokens}` are left verbatim. A template with no token at all is
|
|
375
|
+
* returned unchanged and therefore repeats for every row — Japa's behaviour,
|
|
376
|
+
* and what the golden dataset spec pins down.
|
|
377
|
+
*/
|
|
378
|
+
export declare function interpolateDatasetTitle(template: string, row: unknown, index: number): string;
|
|
379
|
+
/**
|
|
380
|
+
* Class-level extension surface (Japa `Test.macro`). Registers a named method
|
|
381
|
+
* available on every test handle; `this` inside it is the handle, so it can
|
|
382
|
+
* chain (`Test.macro('slow', function () { this.tags(['@slow']); return this })`).
|
|
383
|
+
* Pair with a `declare module` augmentation for the types.
|
|
384
|
+
*/
|
|
385
|
+
export declare const Test: {
|
|
386
|
+
macro(name: string, fn: (this: TestHandle, ...args: unknown[]) => unknown): void;
|
|
118
387
|
};
|
|
119
388
|
export declare const describe: SuiteApi;
|
|
120
389
|
export declare const test: TestApi;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../../src/runtime/suite.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"suite.d.ts","sourceRoot":"","sources":["../../src/runtime/suite.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEnE;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;AAE/C;;;;GAIG;A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