@c9up/helix 0.2.3 → 0.2.5
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 +25 -111
- package/bin/helix.js +24 -41
- package/dist/cli/failed-cache.d.ts +2 -2
- package/dist/cli/failed-cache.js +2 -2
- package/dist/cli/pool.d.ts +3 -3
- package/dist/cli/reporter.d.ts +1 -1
- package/dist/cli/reporter.js +2 -2
- package/dist/cli/run.d.ts +5 -5
- package/dist/cli/run.js +4 -4
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/runner.d.ts +1 -1
- package/dist/cli/runner.js +1 -1
- package/dist/cli/suites.d.ts +4 -4
- package/dist/cli/suites.d.ts.map +1 -1
- package/dist/cli/suites.js +4 -4
- package/dist/cli/suites.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/native/generated.d.ts +2 -2
- package/dist/native/generated.d.ts.map +1 -1
- package/dist/runtime/assert.d.ts +18 -18
- package/dist/runtime/assert.d.ts.map +1 -1
- package/dist/runtime/assert.js +3 -3
- package/dist/runtime/assert.js.map +1 -1
- package/dist/runtime/bootstrap.d.ts +2 -2
- package/dist/runtime/bootstrap.js +3 -3
- package/dist/runtime/bootstrap.js.map +1 -1
- package/dist/runtime/cli-args.d.ts +6 -6
- package/dist/runtime/cli-args.d.ts.map +1 -1
- package/dist/runtime/cli-args.js +5 -5
- package/dist/runtime/cli-args.js.map +1 -1
- package/dist/runtime/cli-worker.js +3 -0
- package/dist/runtime/cli-worker.js.map +1 -1
- package/dist/runtime/configure.d.ts +43 -43
- package/dist/runtime/configure.d.ts.map +1 -1
- package/dist/runtime/configure.js +11 -11
- package/dist/runtime/configure.js.map +1 -1
- package/dist/runtime/context.d.ts +9 -9
- package/dist/runtime/context.d.ts.map +1 -1
- package/dist/runtime/context.js +10 -10
- package/dist/runtime/context.js.map +1 -1
- package/dist/runtime/emitter.d.ts +13 -13
- package/dist/runtime/emitter.d.ts.map +1 -1
- package/dist/runtime/emitter.js +6 -6
- package/dist/runtime/expect.d.ts.map +1 -1
- package/dist/runtime/expect.js +2 -2
- package/dist/runtime/expect.js.map +1 -1
- package/dist/runtime/global-hooks.d.ts +1 -1
- package/dist/runtime/global-hooks.js +1 -1
- package/dist/runtime/matchers.d.ts.map +1 -1
- package/dist/runtime/matchers.js +3 -6
- package/dist/runtime/matchers.js.map +1 -1
- package/dist/runtime/run.d.ts +13 -13
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +47 -47
- package/dist/runtime/run.js.map +1 -1
- package/dist/runtime/runner.d.ts +12 -12
- package/dist/runtime/runner.d.ts.map +1 -1
- package/dist/runtime/runner.js +10 -10
- package/dist/runtime/runner.js.map +1 -1
- package/dist/runtime/suite-config.d.ts +1 -1
- package/dist/runtime/suite-config.js +1 -1
- package/dist/runtime/suite-taps.d.ts +17 -17
- package/dist/runtime/suite-taps.d.ts.map +1 -1
- package/dist/runtime/suite-taps.js +7 -7
- package/dist/runtime/suite-taps.js.map +1 -1
- package/dist/runtime/suite.d.ts +43 -43
- package/dist/runtime/suite.d.ts.map +1 -1
- package/dist/runtime/suite.js +16 -15
- package/dist/runtime/suite.js.map +1 -1
- package/dist/runtime/test-context.d.ts +8 -8
- package/dist/runtime/test-context.d.ts.map +1 -1
- package/dist/runtime/test-context.js +5 -5
- package/dist/runtime/test-context.js.map +1 -1
- package/dist/runtime/thenable.d.ts +22 -0
- package/dist/runtime/thenable.d.ts.map +1 -0
- package/dist/runtime/thenable.js +35 -0
- package/dist/runtime/thenable.js.map +1 -0
- package/dist/runtime/worker.js +4 -4
- package/dist/runtime/worker.js.map +1 -1
- package/dist/time/freeze.js +1 -0
- package/dist/time/freeze.js.map +1 -1
- package/index.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
package/dist/runtime/cli-args.js
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* worker through the environment (`HELIX_TAGS`, `HELIX_TESTS`, …), because a
|
|
6
6
|
* worker is spawned by either orchestrator (Node pool or the Rust engine) with
|
|
7
7
|
* a fixed instruction shape. Reading them back here is what lets both the
|
|
8
|
-
* runtime and a plugin (`api.cliArgs
|
|
8
|
+
* runtime and a plugin (`api.cliArgs`) see the same filters.
|
|
9
9
|
*
|
|
10
|
-
* One named deviation from
|
|
10
|
+
* One named deviation from helix's `CLIArgs`: values are parsed (`string[]`,
|
|
11
11
|
* `number`, `boolean`) rather than kept as raw CLI strings. They have been
|
|
12
12
|
* through the parser once already, on the CLI side, and handing a plugin
|
|
13
|
-
* `"500"` to re-parse would be worse —
|
|
13
|
+
* `"500"` to re-parse would be worse — helix's own raw form exists because its
|
|
14
14
|
* CLI hands the config manager unparsed argv, which helix's does not.
|
|
15
15
|
*/
|
|
16
16
|
/** Comma-separated env list → trimmed non-empty entries, or undefined. */
|
|
@@ -40,14 +40,14 @@ export function envTags() {
|
|
|
40
40
|
export function envMatchAll() {
|
|
41
41
|
return process.env.HELIX_MATCH_ALL === "1" ? true : undefined;
|
|
42
42
|
}
|
|
43
|
-
/** A boolean flag as forwarded by the CLI — absent stays `undefined`, as in
|
|
43
|
+
/** A boolean flag as forwarded by the CLI — absent stays `undefined`, as in helix. */
|
|
44
44
|
function envFlag(name) {
|
|
45
45
|
return process.env[name] === "1" ? true : undefined;
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* The run's flags, as ONE object.
|
|
49
49
|
*
|
|
50
|
-
*
|
|
50
|
+
* helix hands its plugins a `cliArgs` they may edit — that is a documented way
|
|
51
51
|
* to steer a run from a plugin. Rebuilding it from the environment on every
|
|
52
52
|
* access would silently drop those edits, so it is built once and every reader
|
|
53
53
|
* (the plugin API, and the runtime's own filter resolution) shares it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../../src/runtime/cli-args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAmDH,0EAA0E;AAC1E,MAAM,UA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66
66
|
}
|
|
67
67
|
if (parsed &&
|
|
68
68
|
typeof parsed === "object" &&
|
|
69
|
+
"type" in parsed &&
|
|
69
70
|
parsed.type === "run" &&
|
|
71
|
+
"file" in parsed &&
|
|
70
72
|
typeof parsed.file === "string" &&
|
|
73
|
+
"nonce" in parsed &&
|
|
71
74
|
typeof parsed.nonce === "string") {
|
|
72
75
|
return parsed;
|
|
73
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-worker.js","sourceRoot":"","sources":["../../src/runtime/cli-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS1C,KAAK,UAAU,IAAI,CAAC,GAAY;IAC/B,MAAM,IAAI,GAAG,GAAG,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC;IACvD,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;YAClC,IAAI,GAAG;gBAAE,MAAM,CAAC,GAAG,CAAC,CAAC;;gBAChB,OAAO,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,QAAQ,CAAC,GAAY;IAC7B,IAAI,CAAC;QACJ,SAAS,CAAC,CAAC,EAAE,GAAG,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACR,qCAAq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KAAK,CAAC,CAAC,CAAC,SAAS;YACzD,KAAK,EAAE,KAAK,CAAC,KAAK;SAClB,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC;QACJ,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,IAAI,EAAE;YAC5C,SAAS,EAAE,KAAK,CAAC,SAAS;SAC1B,CAAC,CAAC;QACH,MAAM,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3D,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACd,MAAM,IAAI,CAAC;YACV,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;YACzD,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;YACnD,KAAK,EAAE,KAAK,CAAC,KAAK;SAClB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACnB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACtB,CAAC;AACF,CAAC;AAED,KAAK,IAAI,EAAE,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `configure({ plugins })` — the
|
|
2
|
+
* `configure({ plugins })` — the helix/AdonisJS bootstrap entry.
|
|
3
3
|
*
|
|
4
|
-
* Following
|
|
4
|
+
* Following helix precisely: the runtime core is plugin-agnostic, and every
|
|
5
5
|
* capability (HTTP `client`, `db`, fakes, …) ships as a PLUGIN that extends the
|
|
6
6
|
* injected test context. A plugin is a function handed a {@link PluginApi};
|
|
7
7
|
* it registers context properties via `api.context.macro` / `.getter` (the
|
|
8
|
-
* `TestContext.macro`/`getter` of
|
|
8
|
+
* `TestContext.macro`/`getter` of helix) and pairs that with a `declare module`
|
|
9
9
|
* augmentation for the types.
|
|
10
10
|
*
|
|
11
11
|
* // tests/bootstrap.ts
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* This keeps `@c9up/helix` (the core) free of any ecosystem dependency: the
|
|
17
17
|
* plugins live in each package's `/testing` subpath and depend on helix, never
|
|
18
|
-
* the other way round — the
|
|
18
|
+
* the other way round — the helix "runner + plugins" topology.
|
|
19
19
|
*/
|
|
20
20
|
import { type CLIArgs } from "./cli-args.js";
|
|
21
21
|
import { type TestContext } from "./context.js";
|
|
@@ -23,7 +23,7 @@ import { type Emitter } from "./emitter.js";
|
|
|
23
23
|
import { Runner } from "./runner.js";
|
|
24
24
|
import { type SuiteHandle, type SuiteHook, type SuiteHookCleanup } from "./suite-taps.js";
|
|
25
25
|
/**
|
|
26
|
-
* What a plugin uses to extend the test context. Mirrors
|
|
26
|
+
* What a plugin uses to extend the test context. Mirrors helix's
|
|
27
27
|
* `TestContext.macro(name, value)` / `TestContext.getter(name, fn)`.
|
|
28
28
|
*/
|
|
29
29
|
export interface PluginContext {
|
|
@@ -32,46 +32,46 @@ export interface PluginContext {
|
|
|
32
32
|
/** Add a lazily-computed, per-context property (cached per context). */
|
|
33
33
|
getter(name: string, fn: (ctx: TestContext) => unknown): void;
|
|
34
34
|
}
|
|
35
|
-
/** A runner-level hook —
|
|
35
|
+
/** A runner-level hook — helix's shape, defined once in `suite-taps.ts`. */
|
|
36
36
|
export type RunnerHook = SuiteHook;
|
|
37
37
|
export type RunnerHookCleanup = SuiteHookCleanup;
|
|
38
38
|
/**
|
|
39
39
|
* The API handed to each plugin at {@link configure} time.
|
|
40
40
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
41
|
+
* Four members carry the run — `config`, `cliArgs`, `runner`, `emitter` — plus
|
|
42
|
+
* two helix adds: `context`, so a plugin extends the injected test context
|
|
43
|
+
* without importing the `TestContext` class, and `cleanup`, so a plugin that
|
|
44
|
+
* boots something at configure time has a shutdown point.
|
|
45
45
|
*/
|
|
46
46
|
export interface PluginApi {
|
|
47
47
|
/**
|
|
48
|
-
* The options this run was configured with
|
|
49
|
-
*
|
|
48
|
+
* The options this run was configured with. Mutable: a plugin edits it,
|
|
49
|
+
* and the runner reads it back once every plugin has run.
|
|
50
50
|
*/
|
|
51
51
|
config: ConfigureOptions;
|
|
52
|
-
/** The flags the CLI forwarded to this worker (
|
|
52
|
+
/** The flags the CLI forwarded to this worker (`cliArgs`). */
|
|
53
53
|
cliArgs: CLIArgs;
|
|
54
|
-
/** Run-level counters, readable once the run ends (
|
|
54
|
+
/** Run-level counters, readable once the run ends (`runner`). */
|
|
55
55
|
runner: Runner;
|
|
56
|
-
/** Lifecycle events — `test:start`, `group:end`, … (
|
|
56
|
+
/** Lifecycle events — `test:start`, `group:end`, … (`emitter`). */
|
|
57
57
|
emitter: Emitter;
|
|
58
58
|
/** Extend the injected test context. */
|
|
59
59
|
context: PluginContext;
|
|
60
60
|
/**
|
|
61
61
|
* Register a teardown that runs ONCE after all tests in the run finish
|
|
62
62
|
* (reverse registration order) — the place to close a booted server, a DB
|
|
63
|
-
* pool, etc. (
|
|
63
|
+
* pool, etc. (runner teardown). Without this, a plugin that boots
|
|
64
64
|
* a resource at `configure()` has no clean shutdown point.
|
|
65
65
|
*/
|
|
66
66
|
cleanup(fn: RunnerHook): void;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
* A helix plugin
|
|
70
|
-
*
|
|
69
|
+
* A helix plugin. Runs once at bootstrap; may be async — e.g. to boot a server
|
|
70
|
+
* before registering `client` on the test context.
|
|
71
71
|
*/
|
|
72
72
|
export type Plugin = (api: PluginApi) => void | Promise<void>;
|
|
73
73
|
/**
|
|
74
|
-
* Filters applied to the tests a file declares (
|
|
74
|
+
* Filters applied to the tests a file declares (`config.filters`).
|
|
75
75
|
*
|
|
76
76
|
* `files` and `suites` are reported, not honoured: they select which FILES run,
|
|
77
77
|
* and helix settles that list in the CLI process before any worker — and
|
|
@@ -81,12 +81,12 @@ export type Plugin = (api: PluginApi) => void | Promise<void>;
|
|
|
81
81
|
*/
|
|
82
82
|
export interface ConfigureFilters {
|
|
83
83
|
/**
|
|
84
|
-
* Path fragments the CLI matched files against (
|
|
84
|
+
* Path fragments the CLI matched files against (`filters.files`).
|
|
85
85
|
* Read-only here: helix settles the file list before a worker exists, so
|
|
86
86
|
* this reports what was selected rather than selecting.
|
|
87
87
|
*/
|
|
88
88
|
files?: string[];
|
|
89
|
-
/** Suite names the run was limited to (
|
|
89
|
+
/** Suite names the run was limited to (`filters.suites`). Read-only. */
|
|
90
90
|
suites?: string[];
|
|
91
91
|
/** Only tests carrying one of these tags (`~@tag`/`!@tag` excludes). */
|
|
92
92
|
tags?: string[];
|
|
@@ -94,90 +94,90 @@ export interface ConfigureFilters {
|
|
|
94
94
|
groups?: string[];
|
|
95
95
|
/** Only tests with these exact titles. */
|
|
96
96
|
tests?: string[];
|
|
97
|
-
/** Require EVERY tag in `tags` instead of any (
|
|
97
|
+
/** Require EVERY tag in `tags` instead of any (`--match-all`). */
|
|
98
98
|
matchAll?: boolean;
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
|
-
*
|
|
101
|
+
* helix's `Refiner`, as much of it as means anything here: a handle that ADDS
|
|
102
102
|
* filters. It writes straight into {@link ConfigureOptions.filters}, so a
|
|
103
103
|
* plugin calling `refiner.add("tags", [...])` steers the run exactly as setting
|
|
104
104
|
* the filter would — the object is a different door to the same room, not a
|
|
105
105
|
* second mechanism.
|
|
106
106
|
*/
|
|
107
107
|
export interface Refiner {
|
|
108
|
-
/** Add filter values for a layer (
|
|
108
|
+
/** Add filter values for a layer (`refiner.add`). */
|
|
109
109
|
add(layer: "tests" | "groups" | "tags", values: string[]): void;
|
|
110
|
-
/** Require every tag instead of any (
|
|
110
|
+
/** Require every tag instead of any (`refiner.matchAllTags`). */
|
|
111
111
|
matchAllTags(toggle?: boolean): void;
|
|
112
112
|
}
|
|
113
113
|
/** Runtime configuration passed to {@link configure}. */
|
|
114
114
|
export interface ConfigureOptions {
|
|
115
|
-
/** Plugins to install — each extends the test context
|
|
115
|
+
/** Plugins to install — each extends the test context. */
|
|
116
116
|
plugins?: Plugin[];
|
|
117
117
|
/**
|
|
118
|
-
* The directory the run was launched from (
|
|
118
|
+
* The directory the run was launched from (`cwd`). Filled in by the
|
|
119
119
|
* runtime, so a plugin resolving a path against the project reads the same
|
|
120
120
|
* root the CLI discovered from.
|
|
121
121
|
*/
|
|
122
122
|
cwd?: string;
|
|
123
123
|
/**
|
|
124
|
-
* Configure the suite before it runs (
|
|
125
|
-
* the plugins, which is both
|
|
124
|
+
* Configure the suite before it runs (`configureSuite`). Applied AFTER
|
|
125
|
+
* the plugins, which is both helix's order and what lets a plugin read it or
|
|
126
126
|
* put its own in place.
|
|
127
127
|
*
|
|
128
|
-
* May return a promise —
|
|
128
|
+
* May return a promise — helix's is synchronous, but helix's per-suite
|
|
129
129
|
* `configure` has to re-import the config module, and hooks it registers must
|
|
130
130
|
* exist before the setup hooks are drained.
|
|
131
131
|
*/
|
|
132
132
|
configureSuite?: (suite: SuiteHandle) => void | Promise<void>;
|
|
133
133
|
/**
|
|
134
|
-
* The reporters this run activated (
|
|
134
|
+
* The reporters this run activated (`reporters.activated`). Read-only
|
|
135
135
|
* truth: reporters live in the CLI process, so naming one here would not
|
|
136
136
|
* make it run.
|
|
137
137
|
*/
|
|
138
138
|
reporters?: {
|
|
139
139
|
activated: string[];
|
|
140
140
|
};
|
|
141
|
-
/** `process.exit()` once the run ends (
|
|
141
|
+
/** `process.exit()` once the run ends (`forceExit`). */
|
|
142
142
|
forceExit?: boolean;
|
|
143
|
-
/** Directories discovery skipped (
|
|
143
|
+
/** Directories discovery skipped (`exclude`). */
|
|
144
144
|
exclude?: string[];
|
|
145
145
|
/**
|
|
146
|
-
* The filter object (
|
|
146
|
+
* The filter object (`refiner`). Writes through to
|
|
147
147
|
* {@link ConfigureOptions.filters}, so `refiner.add("tags", [...])` from a
|
|
148
148
|
* plugin steers the run exactly as setting the filter would.
|
|
149
149
|
*/
|
|
150
150
|
refiner?: Refiner;
|
|
151
151
|
/**
|
|
152
|
-
* Filters to apply to this file's tests (
|
|
152
|
+
* Filters to apply to this file's tests (`config.filters`). The CLI
|
|
153
153
|
* flags win: a filter typed at the prompt overrides the configured one.
|
|
154
154
|
*/
|
|
155
155
|
filters?: ConfigureFilters;
|
|
156
156
|
/**
|
|
157
|
-
* How a test file is imported (
|
|
157
|
+
* How a test file is imported (`config.importer`). Defaults to
|
|
158
158
|
* `import(file.href)`. Receives the URL helix would have imported —
|
|
159
159
|
* cache-busting query included, so repeated runs still re-evaluate.
|
|
160
160
|
*/
|
|
161
161
|
importer?: (file: URL) => void | Promise<void>;
|
|
162
|
-
/** Run once before the tests (
|
|
162
|
+
/** Run once before the tests (runner `setup`). */
|
|
163
163
|
setup?: RunnerHook[];
|
|
164
|
-
/** Run once after the tests, reverse order (
|
|
164
|
+
/** Run once after the tests, reverse order (runner `teardown`). */
|
|
165
165
|
teardown?: RunnerHook[];
|
|
166
166
|
/**
|
|
167
|
-
* Default per-test timeout in ms for this file's tests (
|
|
167
|
+
* Default per-test timeout in ms for this file's tests (`configure({
|
|
168
168
|
* timeout })`). `0` disables. Overridden by `--timeout` and by a per-test
|
|
169
169
|
* `test.timeout(ms)` / `{ timeout }`.
|
|
170
170
|
*/
|
|
171
171
|
timeout?: number;
|
|
172
172
|
/**
|
|
173
|
-
* Default extra attempts on failure for this file's tests (
|
|
173
|
+
* Default extra attempts on failure for this file's tests (`configure({
|
|
174
174
|
* retries })`). Overridden by `--retries` and by a per-test `test.retry(n)`.
|
|
175
175
|
*/
|
|
176
176
|
retries?: number;
|
|
177
177
|
/**
|
|
178
178
|
* The name of the suite these tests belong to — surfaced as
|
|
179
179
|
* `ctx.test.options.meta.suite.name` and on the `suite:*` events. Defaults to
|
|
180
|
-
* `"default"`, the name
|
|
180
|
+
* `"default"`, the name helix gives its implicit suite. Overridden by
|
|
181
181
|
* `--suite`.
|
|
182
182
|
*/
|
|
183
183
|
suite?: string;
|
|
@@ -194,9 +194,9 @@ interface ConfiguredDefaults {
|
|
|
194
194
|
export declare function getConfiguredDefaults(): Readonly<ConfiguredDefaults>;
|
|
195
195
|
/**
|
|
196
196
|
* Install plugins + runner hooks. Call once from a bootstrap file
|
|
197
|
-
* (
|
|
197
|
+
* (helix/AdonisJS `bin/test.ts` / `tests/bootstrap.ts`).
|
|
198
198
|
*
|
|
199
|
-
* Order follows
|
|
199
|
+
* Order follows helix: PLUGINS first, then the run's `setup` hooks, then the
|
|
200
200
|
* `teardown` hooks are parked for after the run (see {@link
|
|
201
201
|
* drainRunnerTeardowns}). That ordering is what makes a plugin's edits count —
|
|
202
202
|
* it can raise `config.timeout`, push a `setup` hook, or reach for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../src/runtime/configure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,KAAK,OAAO,EAAW,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAEN,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,gBAAgB,EAErB,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B,2DAA2D;IAC3D,KAAK,C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.
|
|
3
3
|
*
|
|
4
|
-
* Following
|
|
4
|
+
* Following helix precisely: the runtime core is plugin-agnostic, and every
|
|
5
5
|
* capability (HTTP `client`, `db`, fakes, …) ships as a PLUGIN that extends the
|
|
6
6
|
* injected test context. A plugin is a function handed a {@link PluginApi};
|
|
7
7
|
* it registers context properties via `api.context.macro` / `.getter` (the
|
|
8
|
-
* `TestContext.macro`/`getter` of
|
|
8
|
+
* `TestContext.macro`/`getter` of helix) and pairs that with a `declare module`
|
|
9
9
|
* augmentation for the types.
|
|
10
10
|
*
|
|
11
11
|
* // tests/bootstrap.ts
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* This keeps `@c9up/helix` (the core) free of any ecosystem dependency: the
|
|
17
17
|
* plugins live in each package's `/testing` subpath and depend on helix, never
|
|
18
|
-
* the other way round — the
|
|
18
|
+
* the other way round — the helix "runner + plugins" topology.
|
|
19
19
|
*/
|
|
20
20
|
import { cliArgs } from "./cli-args.js";
|
|
21
21
|
import { TestContextRegistry } from "./context.js";
|
|
@@ -44,11 +44,11 @@ export function getConfiguredDefaults() {
|
|
|
44
44
|
}
|
|
45
45
|
/** Tracks the run by listening to {@link emitter} — handed to plugins. */
|
|
46
46
|
const runner = new Runner(emitter);
|
|
47
|
-
/** The options the last {@link configure} call resolved to (
|
|
47
|
+
/** The options the last {@link configure} call resolved to (`config`). */
|
|
48
48
|
let resolvedConfig = {};
|
|
49
49
|
const api = {
|
|
50
50
|
// A getter so a plugin reads the config of the `configure()` call it is
|
|
51
|
-
// running under, not an empty object captured at module load.
|
|
51
|
+
// running under, not an empty object captured at module load. helix lets a
|
|
52
52
|
// plugin EDIT it (that is how a plugin raises the default timeout), so the
|
|
53
53
|
// object is handed over mutable and read back after every plugin has run.
|
|
54
54
|
get config() {
|
|
@@ -71,9 +71,9 @@ const api = {
|
|
|
71
71
|
};
|
|
72
72
|
/**
|
|
73
73
|
* Install plugins + runner hooks. Call once from a bootstrap file
|
|
74
|
-
* (
|
|
74
|
+
* (helix/AdonisJS `bin/test.ts` / `tests/bootstrap.ts`).
|
|
75
75
|
*
|
|
76
|
-
* Order follows
|
|
76
|
+
* Order follows helix: PLUGINS first, then the run's `setup` hooks, then the
|
|
77
77
|
* `teardown` hooks are parked for after the run (see {@link
|
|
78
78
|
* drainRunnerTeardowns}). That ordering is what makes a plugin's edits count —
|
|
79
79
|
* it can raise `config.timeout`, push a `setup` hook, or reach for
|
|
@@ -90,7 +90,7 @@ export async function configure(options) {
|
|
|
90
90
|
const teardown = resolvedConfig.teardown;
|
|
91
91
|
const handle = makeSuiteHandle(options.suite ?? "default", setup, teardown);
|
|
92
92
|
setCurrentSuite(handle);
|
|
93
|
-
// The rest of
|
|
93
|
+
// The rest of helix's `BaseConfig`, filled with what this run actually is, so
|
|
94
94
|
// a plugin reading `api.config` is told the truth rather than `undefined`.
|
|
95
95
|
const flags = cliArgs();
|
|
96
96
|
resolvedConfig.cwd ??= process.cwd();
|
|
@@ -104,7 +104,7 @@ export async function configure(options) {
|
|
|
104
104
|
for (const plugin of resolvedConfig.plugins ?? []) {
|
|
105
105
|
await plugin(api);
|
|
106
106
|
}
|
|
107
|
-
//
|
|
107
|
+
// helix order: plugins, THEN `runner.onSuite(config.configureSuite)`, then the
|
|
108
108
|
// setup hooks. Applying it here rather than earlier is what lets a plugin
|
|
109
109
|
// read it — or put its own in place — and still have it take effect.
|
|
110
110
|
await resolvedConfig.configureSuite?.(handle);
|
|
@@ -120,7 +120,7 @@ export async function configure(options) {
|
|
|
120
120
|
configuredDefaults.filters = resolvedConfig.filters;
|
|
121
121
|
if (resolvedConfig.importer !== undefined)
|
|
122
122
|
configuredDefaults.importer = resolvedConfig.importer;
|
|
123
|
-
//
|
|
123
|
+
// helix skips the global setup hooks under `--list-pinned`: nothing runs, so
|
|
124
124
|
// nothing should be opened.
|
|
125
125
|
const listing = cliArgs().listPinned === true;
|
|
126
126
|
for (const fn of listing ? [] : setup) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/runtime/configure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAgB,OAAO,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAoB,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAgB,OAAO,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACN,eAAe,EAIf,eAAe,GACf,MAAM,iBAAiB,CAAC;AAgGzB,sDAAsD;AACtD,SAAS,WAAW,CAAC,OAAyB;IAC7C,OAAO;QACN,GAAG,CAAC,KAAK,EAAE,MAAM;YAChB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC;QACzD,CAAC;QACD,YAAY,CAAC,MAAM,GAAG,IAAI;YACzB,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC;QAC3B,CAAC;KACD,CAAC;AACH,CAAC;AAyED,uFAAuF;AACvF,MAAM,eAAe,GAAiB,EAAE,CAAC;AAEzC,sEAAsE;AACtE,MAAM,cAAc,GAAwB,EAAE,CAAC;AAW/C,MAAM,kBAAkB,GAAuB,EAAE,CAAC;AAElD,qDAAqD;AACrD,MAAM,UAAU,qBAAqB;IACpC,OAAO,kBAAkB,CAAC;AAC3B,CAAC;AAED,0EAA0E;AAC1E,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;AAEnC
|
|
1
|
+
{"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/runtime/configure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAgB,OAAO,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAoB,mBAAmB,EAAE,MAAM,cAAc,CAA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AC;IACD,KAAK,MAAM,EAAE,IAAI,QAAQ;QAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACrD,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACzC,2EAA2E;IAC3E,6EAA6E;IAC7E,oEAAoE;IACpE,KAAK,IAAI,CAAC,GAAG,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxD,IAAI,CAAC;YACJ,MAAM,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;QACtD,CAAC;IACF,CAAC;IACD,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1B,KAAK,IAAI,CAAC,GAAG,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACzD,IAAI,CAAC;YACJ,MAAM,eAAe,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,GAAG,CAAC,CAAC;QACvD,CAAC;IACF,CAAC;IACD,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Injected test context —
|
|
2
|
+
* Injected test context — helix's defining mechanism.
|
|
3
3
|
*
|
|
4
4
|
* Every test body (and, later, group hooks) receives a `TestContext` as its
|
|
5
5
|
* FIRST argument: `test("x", ({ assert, client, db, cleanup }) => …)`. The
|
|
@@ -31,32 +31,32 @@ import { type TestCleanup } from "./test-context.js";
|
|
|
31
31
|
* declaration merging — `declare module "@c9up/helix" { interface TestContext {
|
|
32
32
|
* client: ApiClient } }` — without breaking the core's construction (an external
|
|
33
33
|
* augmentation is not subject to helix's `strictPropertyInitialization`). This
|
|
34
|
-
* is exactly how
|
|
34
|
+
* is exactly how helix's `TestContext` works.
|
|
35
35
|
*/
|
|
36
36
|
export declare class TestContext {
|
|
37
37
|
/**
|
|
38
|
-
* Add a shared property to every test context —
|
|
39
|
-
* `TestContext.macro('sleep', fn)`, callable on the class itself so a
|
|
38
|
+
* Add a shared property to every test context — helix's
|
|
39
|
+
* `TestContext.macro('sleep', fn)`, callable on the class itself so a helix
|
|
40
40
|
* plugin's registration code ports over unchanged.
|
|
41
41
|
*/
|
|
42
42
|
static macro(name: string, value: unknown): void;
|
|
43
|
-
/** Add a lazily-computed, per-context property (
|
|
43
|
+
/** Add a lazily-computed, per-context property (`TestContext.getter`). */
|
|
44
44
|
static getter(name: string, fn: Getter): void;
|
|
45
|
-
/** Chai-flavored assertions (
|
|
45
|
+
/** Chai-flavored assertions (`helix's assert` parity), alongside `expect`. */
|
|
46
46
|
readonly assert: Assert;
|
|
47
|
-
/** The running test's own instance — name, options, dataset (
|
|
47
|
+
/** The running test's own instance — name, options, dataset (`ctx.test`). */
|
|
48
48
|
readonly test: TestInstance;
|
|
49
49
|
constructor(test: TestInstance);
|
|
50
50
|
/**
|
|
51
51
|
* Register a teardown that runs at the end of THIS test, regardless of
|
|
52
|
-
* outcome (
|
|
52
|
+
* outcome (`ctx.cleanup`). Reverse-insertion order, isolated failures.
|
|
53
53
|
*/
|
|
54
54
|
cleanup(fn: TestCleanup): void;
|
|
55
55
|
}
|
|
56
56
|
export type Getter = (this: TestContext, ctx: TestContext) => unknown;
|
|
57
57
|
/**
|
|
58
58
|
* Registry through which plugins extend the test context at runtime. Mirrors
|
|
59
|
-
*
|
|
59
|
+
* helix's `TestContext.macro(name, value)` / `TestContext.getter(name, fn)`.
|
|
60
60
|
* Pair each call with a `declare module` augmentation for the types.
|
|
61
61
|
*/
|
|
62
62
|
export declare const TestContextRegistry: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE1E;;;;GAIG;AACH;;;;;;GAMG;AACH,qBAAa,WAAW;IACvB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAIhD
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE1E;;;;GAIG;AACH;;;;;;GAMG;AACH,qBAAa,WAAW;IACvB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAIhD,0EAA0E;IAC1E,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI;IAI7C,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;gBAEhB,IAAI,EAAE,YAAY;IAK9B;;;OAGG;IACH,OAAO,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI;CAK9B;AAID,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,WAAW,KAAK,OAAO,CAAC;AAKtE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;IAC/B,2DAA2D;gBAC/C,MAAM,SAAS,OAAO,GAAG,IAAI;IAGzC;;;;OAIG;iBACU,MAAM,MAAM,MAAM,GAAG,IAAI;IAGtC,yEAAyE;iBAC5D,MAAM,GAAG,IAAI;IAS1B,wDAAwD;cAC9C,MAAM,GAAG,OAAO;CAG1B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,WAAW,CAqChE"}
|
package/dist/runtime/context.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Injected test context —
|
|
2
|
+
* Injected test context — helix's defining mechanism.
|
|
3
3
|
*
|
|
4
4
|
* Every test body (and, later, group hooks) receives a `TestContext` as its
|
|
5
5
|
* FIRST argument: `test("x", ({ assert, client, db, cleanup }) => …)`. The
|
|
@@ -30,24 +30,24 @@ import { registerTestCleanup } from "./test-context.js";
|
|
|
30
30
|
* declaration merging — `declare module "@c9up/helix" { interface TestContext {
|
|
31
31
|
* client: ApiClient } }` — without breaking the core's construction (an external
|
|
32
32
|
* augmentation is not subject to helix's `strictPropertyInitialization`). This
|
|
33
|
-
* is exactly how
|
|
33
|
+
* is exactly how helix's `TestContext` works.
|
|
34
34
|
*/
|
|
35
35
|
export class TestContext {
|
|
36
36
|
/**
|
|
37
|
-
* Add a shared property to every test context —
|
|
38
|
-
* `TestContext.macro('sleep', fn)`, callable on the class itself so a
|
|
37
|
+
* Add a shared property to every test context — helix's
|
|
38
|
+
* `TestContext.macro('sleep', fn)`, callable on the class itself so a helix
|
|
39
39
|
* plugin's registration code ports over unchanged.
|
|
40
40
|
*/
|
|
41
41
|
static macro(name, value) {
|
|
42
42
|
TestContextRegistry.macro(name, value);
|
|
43
43
|
}
|
|
44
|
-
/** Add a lazily-computed, per-context property (
|
|
44
|
+
/** Add a lazily-computed, per-context property (`TestContext.getter`). */
|
|
45
45
|
static getter(name, fn) {
|
|
46
46
|
TestContextRegistry.getter(name, fn);
|
|
47
47
|
}
|
|
48
|
-
/** Chai-flavored assertions (
|
|
48
|
+
/** Chai-flavored assertions (`helix's assert` parity), alongside `expect`. */
|
|
49
49
|
assert;
|
|
50
|
-
/** The running test's own instance — name, options, dataset (
|
|
50
|
+
/** The running test's own instance — name, options, dataset (`ctx.test`). */
|
|
51
51
|
test;
|
|
52
52
|
constructor(test) {
|
|
53
53
|
this.assert = createAssert();
|
|
@@ -55,7 +55,7 @@ export class TestContext {
|
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Register a teardown that runs at the end of THIS test, regardless of
|
|
58
|
-
* outcome (
|
|
58
|
+
* outcome (`ctx.cleanup`). Reverse-insertion order, isolated failures.
|
|
59
59
|
*/
|
|
60
60
|
cleanup(fn) {
|
|
61
61
|
// Falls through to the active per-test frame; a false return means we were
|
|
@@ -67,7 +67,7 @@ const macros = new Map();
|
|
|
67
67
|
const getters = new Map();
|
|
68
68
|
/**
|
|
69
69
|
* Registry through which plugins extend the test context at runtime. Mirrors
|
|
70
|
-
*
|
|
70
|
+
* helix's `TestContext.macro(name, value)` / `TestContext.getter(name, fn)`.
|
|
71
71
|
* Pair each call with a `declare module` augmentation for the types.
|
|
72
72
|
*/
|
|
73
73
|
export const TestContextRegistry = {
|
|
@@ -110,7 +110,7 @@ export function buildTestContext(test) {
|
|
|
110
110
|
const ctx = new TestContext(test);
|
|
111
111
|
// `cleanup` and `test` are structural — the runtime hands them to the body
|
|
112
112
|
// and nothing may take their place. `assert` is NOT: helix ships one, and a
|
|
113
|
-
// project installing
|
|
113
|
+
// project installing `helix's assert` is asking for that one instead. Refusing
|
|
114
114
|
// the override left the plugin registered but never reached, which is how
|
|
115
115
|
// `plugins: [assert()]` could look wired and do nothing.
|
|
116
116
|
const reserved = new Set(["cleanup", "test"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAe,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAoB,MAAM,mBAAmB,CAAC;AAE1E;;;;GAIG;AACH;;;;;;GAMG;AACH,MAAM,OAAO,WAAW;IACvB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,IAAY,EAAE,KAAc;QACxC,mBAAmB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/runtime/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAe,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAoB,MAAM,mBAAmB,CAAC;AAE1E;;;;GAIG;AACH;;;;;;GAMG;AACH,MAAM,OAAO,WAAW;IACvB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,IAAY,EAAE,KAAc;QACxC,mBAAmB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,0EAA0E;IAC1E,MAAM,CAAC,MAAM,CAAC,IAAY,EAAE,EAAU;QACrC,mBAAmB,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,8EAA8E;IACrE,MAAM,CAAS;IACxB,6EAA6E;IACpE,IAAI,CAAe;IAE5B,YAAY,IAAkB;QAC7B,IAAI,CAAC,MAAM,GAAG,YAAY,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAClB,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,EAAe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