@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,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The brand that marks an asymmetric matcher, and the guard that reads it.
|
|
3
|
+
*
|
|
4
|
+
* Its own module because both `asymmetric.ts` (which creates matchers) and
|
|
5
|
+
* `equals.ts` (which must recognise them) need it, and `asymmetric.ts` imports
|
|
6
|
+
* `equals.ts` — so neither can own it without a cycle. It used to be spelled as
|
|
7
|
+
* a literal on both sides: a rule written twice, where changing one side would
|
|
8
|
+
* silently stop `expect.any()` from being recognised and turn every matcher
|
|
9
|
+
* into a plain structural comparison.
|
|
10
|
+
*/
|
|
11
|
+
export const ASYMMETRIC_BRAND = "__helixAsymmetricMatcher";
|
|
12
|
+
export function isAsymmetricMatcher(value) {
|
|
13
|
+
if (typeof value !== "object" || value === null)
|
|
14
|
+
return false;
|
|
15
|
+
return (Reflect.get(value, ASYMMETRIC_BRAND) === true &&
|
|
16
|
+
typeof Reflect.get(value, "asymmetricMatch") === "function");
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=asymmetric-brand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asymmetric-brand.js","sourceRoot":"","sources":["../../src/runtime/asymmetric-brand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAU3D,MAAM,UAAU,mBAAmB,CAClC,KAAc;IAEd,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,OAAO,CACN,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,IAAI;QAC7C,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,iBAAiB,CAAC,KAAK,UAAU,CAC3D,CAAC;AACH,CAAC"}
|
|
@@ -7,15 +7,8 @@
|
|
|
7
7
|
* delegate to `asymmetricMatch` instead of doing structural comparison, so an
|
|
8
8
|
* asymmetric matcher can appear anywhere inside an expected value.
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
readonly [BRAND]: true;
|
|
13
|
-
/** Return `true` when `actual` satisfies this matcher. */
|
|
14
|
-
asymmetricMatch(actual: unknown): boolean;
|
|
15
|
-
/** Human-readable label used in failure diagnostics. */
|
|
16
|
-
toString(): string;
|
|
17
|
-
}
|
|
18
|
-
export declare function isAsymmetricMatcher(value: unknown): value is AsymmetricMatcher;
|
|
10
|
+
import { type AsymmetricMatcher, isAsymmetricMatcher } from "./asymmetric-brand.js";
|
|
11
|
+
export { type AsymmetricMatcher, isAsymmetricMatcher };
|
|
19
12
|
/** `expect.anything()` — matches any value except `null`/`undefined`. */
|
|
20
13
|
export declare function anything(): AsymmetricMatcher;
|
|
21
14
|
/** Constructor accepted by `expect.any(...)`, including primitive wrappers. */
|
|
@@ -30,5 +23,4 @@ export declare function stringMatching(pattern: string | RegExp): AsymmetricMatc
|
|
|
30
23
|
export declare function objectContaining(subset: Record<string, unknown>): AsymmetricMatcher;
|
|
31
24
|
/** `expect.arrayContaining(items)` — every item must appear in `actual`. */
|
|
32
25
|
export declare function arrayContaining(items: readonly unknown[]): AsymmetricMatcher;
|
|
33
|
-
export {};
|
|
34
26
|
//# sourceMappingURL=asymmetric.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asymmetric.d.ts","sourceRoot":"","sources":["../../src/runtime/asymmetric.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"asymmetric.d.ts","sourceRoot":"","sources":["../../src/runtime/asymmetric.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEN,KAAK,iBAAiB,EACtB,mBAAmB,EACnB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,KAAK,iBAAiB,EAAE,mBAAmB,EAAE,CAAC;AAWvD,yEAAyE;AACzE,wBAAgB,QAAQ,IAAI,iBAAiB,CAK5C;AAED,+EAA+E;AAC/E,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAC;AAE5D,0EAA0E;AAC1E,wBAAgB,GAAG,CAAC,IAAI,EAAE,WAAW,GAAG,iBAAiB,CAkBxD;AAED,0EAA0E;AAC1E,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAK/D;AAED,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,iBAAiB,CAO1E;AAED,kFAAkF;AAClF,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,iBAAiB,CAInB;AAED,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,GAAG,iBAAiB,CAK5E"}
|
|
@@ -7,14 +7,10 @@
|
|
|
7
7
|
* delegate to `asymmetricMatch` instead of doing structural comparison, so an
|
|
8
8
|
* asymmetric matcher can appear anywhere inside an expected value.
|
|
9
9
|
*/
|
|
10
|
+
import { ASYMMETRIC_BRAND, isAsymmetricMatcher, } from "./asymmetric-brand.js";
|
|
10
11
|
import { equals, partialEquals } from "./equals.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return (typeof value === "object" &&
|
|
14
|
-
value !== null &&
|
|
15
|
-
value[BRAND] === true &&
|
|
16
|
-
typeof value.asymmetricMatch === "function");
|
|
17
|
-
}
|
|
12
|
+
export { isAsymmetricMatcher };
|
|
13
|
+
const BRAND = ASYMMETRIC_BRAND;
|
|
18
14
|
function make(label, match) {
|
|
19
15
|
return { [BRAND]: true, asymmetricMatch: match, toString: () => label };
|
|
20
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asymmetric.js","sourceRoot":"","sources":["../../src/runtime/asymmetric.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"asymmetric.js","sourceRoot":"","sources":["../../src/runtime/asymmetric.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACN,gBAAgB,EAEhB,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,a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CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `tests/bootstrap.ts` — the AdonisJS bootstrap module.
|
|
3
|
+
*
|
|
4
|
+
* Adonis puts the run's plugins, runner hooks and suite hooks in one file that
|
|
5
|
+
* `bin/test.ts` imports before anything else:
|
|
6
|
+
*
|
|
7
|
+
* // tests/bootstrap.ts
|
|
8
|
+
* export const plugins = [assert(), apiClient()]
|
|
9
|
+
* export const runnerHooks = { setup: [() => …], teardown: [() => …] }
|
|
10
|
+
* export const configureSuite = (suite) => {
|
|
11
|
+
* if (["functional", "e2e"].includes(suite.name)) {
|
|
12
|
+
* return suite.setup(() => testUtils.httpServer().start())
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* helix loads the same file with the same three exports — plus `filters` and
|
|
17
|
+
* `importer`, the two Japa `Config` fields Adonis sets in `bin/test.ts`, which
|
|
18
|
+
* helix has no equivalent of — so an Adonis `tests/bootstrap.ts` ports over
|
|
19
|
+
* unchanged. The CLI resolves it once and
|
|
20
|
+
* forwards the absolute path as `HELIX_BOOTSTRAP`, so it reaches the worker
|
|
21
|
+
* through BOTH orchestrators (the Rust engine and the TS pool spawn children
|
|
22
|
+
* that inherit the CLI's env).
|
|
23
|
+
*
|
|
24
|
+
* `runnerHooks` run ONCE for the whole run, in the process that spawns the
|
|
25
|
+
* workers — Japa's semantics. See `global-hooks.ts`. Everything else here is
|
|
26
|
+
* per worker because it has to be: a context macro, a filter, an importer only
|
|
27
|
+
* mean anything in the process that loads the test file.
|
|
28
|
+
*/
|
|
29
|
+
/** File names probed under the project root when none is configured. */
|
|
30
|
+
export declare const BOOTSTRAP_FILENAMES: string[];
|
|
31
|
+
/**
|
|
32
|
+
* Resolve the bootstrap file for `root`: an explicit path (from
|
|
33
|
+
* `helix.config`), else the conventional `tests/bootstrap.*`. Returns
|
|
34
|
+
* `undefined` when the project has none — having no bootstrap is the norm, not
|
|
35
|
+
* an error.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveBootstrap(root: string, configured?: string): string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Import the bootstrap module named by `HELIX_BOOTSTRAP` and hand its exports
|
|
40
|
+
* to {@link configure}. A no-op when the variable is unset — which is what
|
|
41
|
+
* every project without a bootstrap file, and every direct `runTestFile`
|
|
42
|
+
* caller, sees.
|
|
43
|
+
*/
|
|
44
|
+
export declare function loadBootstrap(suite: string): Promise<void>;
|
|
45
|
+
/** Test seam: forget that a bootstrap was loaded in this process. */
|
|
46
|
+
export declare function resetBootstrap(): void;
|
|
47
|
+
//# sourceMappingURL=bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/runtime/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAeH,wEAAwE;AACxE,eAAO,MAAM,mBAAmB,UAI/B,CAAC;AAuEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC/B,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,GACjB,MAAM,GAAG,SAAS,CAYpB;AAKD;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAShE;AAgCD,qEAAqE;AACrE,wBAAgB,cAAc,IAAI,IAAI,CAGrC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `tests/bootstrap.ts` — the AdonisJS bootstrap module.
|
|
3
|
+
*
|
|
4
|
+
* Adonis puts the run's plugins, runner hooks and suite hooks in one file that
|
|
5
|
+
* `bin/test.ts` imports before anything else:
|
|
6
|
+
*
|
|
7
|
+
* // tests/bootstrap.ts
|
|
8
|
+
* export const plugins = [assert(), apiClient()]
|
|
9
|
+
* export const runnerHooks = { setup: [() => …], teardown: [() => …] }
|
|
10
|
+
* export const configureSuite = (suite) => {
|
|
11
|
+
* if (["functional", "e2e"].includes(suite.name)) {
|
|
12
|
+
* return suite.setup(() => testUtils.httpServer().start())
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* helix loads the same file with the same three exports — plus `filters` and
|
|
17
|
+
* `importer`, the two Japa `Config` fields Adonis sets in `bin/test.ts`, which
|
|
18
|
+
* helix has no equivalent of — so an Adonis `tests/bootstrap.ts` ports over
|
|
19
|
+
* unchanged. The CLI resolves it once and
|
|
20
|
+
* forwards the absolute path as `HELIX_BOOTSTRAP`, so it reaches the worker
|
|
21
|
+
* through BOTH orchestrators (the Rust engine and the TS pool spawn children
|
|
22
|
+
* that inherit the CLI's env).
|
|
23
|
+
*
|
|
24
|
+
* `runnerHooks` run ONCE for the whole run, in the process that spawns the
|
|
25
|
+
* workers — Japa's semantics. See `global-hooks.ts`. Everything else here is
|
|
26
|
+
* per worker because it has to be: a context macro, a filter, an importer only
|
|
27
|
+
* mean anything in the process that loads the test file.
|
|
28
|
+
*/
|
|
29
|
+
import { existsSync } from "node:fs";
|
|
30
|
+
import path from "node:path";
|
|
31
|
+
import { pathToFileURL } from "node:url";
|
|
32
|
+
import { configure, } from "./configure.js";
|
|
33
|
+
import { globalHooksHandledByParent } from "./global-hooks.js";
|
|
34
|
+
import { applySuiteConfigure } from "./suite-config.js";
|
|
35
|
+
import { resetTaps } from "./suite-taps.js";
|
|
36
|
+
/** File names probed under the project root when none is configured. */
|
|
37
|
+
export const BOOTSTRAP_FILENAMES = [
|
|
38
|
+
"tests/bootstrap.ts",
|
|
39
|
+
"tests/bootstrap.js",
|
|
40
|
+
"tests/bootstrap.mjs",
|
|
41
|
+
];
|
|
42
|
+
/** `filters` as exported — every field optional, so read each defensively. */
|
|
43
|
+
function readFilters(imported) {
|
|
44
|
+
const source = Reflect.get(Object(imported), "filters");
|
|
45
|
+
if (source === null || typeof source !== "object")
|
|
46
|
+
return undefined;
|
|
47
|
+
const matchAll = Reflect.get(source, "matchAll");
|
|
48
|
+
return {
|
|
49
|
+
tags: stringList(source, "tags"),
|
|
50
|
+
groups: stringList(source, "groups"),
|
|
51
|
+
tests: stringList(source, "tests"),
|
|
52
|
+
matchAll: typeof matchAll === "boolean" ? matchAll : undefined,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function stringList(source, key) {
|
|
56
|
+
const value = Reflect.get(source, key);
|
|
57
|
+
if (!Array.isArray(value))
|
|
58
|
+
return undefined;
|
|
59
|
+
return value.filter((v) => typeof v === "string");
|
|
60
|
+
}
|
|
61
|
+
/** Everything about the module is optional — read defensively, never cast. */
|
|
62
|
+
function readModule(imported) {
|
|
63
|
+
if (imported === null || typeof imported !== "object")
|
|
64
|
+
return {};
|
|
65
|
+
const plugins = Reflect.get(imported, "plugins");
|
|
66
|
+
const hooks = Reflect.get(imported, "runnerHooks");
|
|
67
|
+
const configureSuite = Reflect.get(imported, "configureSuite");
|
|
68
|
+
const importer = Reflect.get(imported, "importer");
|
|
69
|
+
return {
|
|
70
|
+
filters: readFilters(imported),
|
|
71
|
+
importer: typeof importer === "function"
|
|
72
|
+
? (file) => importer(file)
|
|
73
|
+
: undefined,
|
|
74
|
+
plugins: Array.isArray(plugins)
|
|
75
|
+
? plugins.filter((p) => typeof p === "function")
|
|
76
|
+
: undefined,
|
|
77
|
+
runnerHooks: hooks !== null && typeof hooks === "object"
|
|
78
|
+
? {
|
|
79
|
+
setup: hookList(hooks, "setup"),
|
|
80
|
+
teardown: hookList(hooks, "teardown"),
|
|
81
|
+
}
|
|
82
|
+
: undefined,
|
|
83
|
+
configureSuite: typeof configureSuite === "function"
|
|
84
|
+
? (suite) => configureSuite(suite)
|
|
85
|
+
: undefined,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function hookList(source, key) {
|
|
89
|
+
const value = Reflect.get(source, key);
|
|
90
|
+
if (!Array.isArray(value))
|
|
91
|
+
return undefined;
|
|
92
|
+
return value.filter((fn) => typeof fn === "function");
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Resolve the bootstrap file for `root`: an explicit path (from
|
|
96
|
+
* `helix.config`), else the conventional `tests/bootstrap.*`. Returns
|
|
97
|
+
* `undefined` when the project has none — having no bootstrap is the norm, not
|
|
98
|
+
* an error.
|
|
99
|
+
*/
|
|
100
|
+
export function resolveBootstrap(root, configured) {
|
|
101
|
+
if (configured !== undefined && configured !== "") {
|
|
102
|
+
const absolute = path.isAbsolute(configured)
|
|
103
|
+
? configured
|
|
104
|
+
: path.resolve(root, configured);
|
|
105
|
+
return existsSync(absolute) ? absolute : undefined;
|
|
106
|
+
}
|
|
107
|
+
for (const name of BOOTSTRAP_FILENAMES) {
|
|
108
|
+
const candidate = path.resolve(root, name);
|
|
109
|
+
if (existsSync(candidate))
|
|
110
|
+
return candidate;
|
|
111
|
+
}
|
|
112
|
+
return undefined;
|
|
113
|
+
}
|
|
114
|
+
/** Memoised so a worker that runs several files bootstraps exactly once. */
|
|
115
|
+
let loaded;
|
|
116
|
+
/**
|
|
117
|
+
* Import the bootstrap module named by `HELIX_BOOTSTRAP` and hand its exports
|
|
118
|
+
* to {@link configure}. A no-op when the variable is unset — which is what
|
|
119
|
+
* every project without a bootstrap file, and every direct `runTestFile`
|
|
120
|
+
* caller, sees.
|
|
121
|
+
*/
|
|
122
|
+
export async function loadBootstrap(suite) {
|
|
123
|
+
const file = process.env.HELIX_BOOTSTRAP;
|
|
124
|
+
const hasSuiteConfig = (process.env.HELIX_SUITE_CONFIG ?? "") !== "";
|
|
125
|
+
// The suite's own `configure` is applied here too, so it reaches the same
|
|
126
|
+
// hook arrays before `configure()` drains them. That means this runs even
|
|
127
|
+
// with no bootstrap file — a project may declare one without the other.
|
|
128
|
+
if ((file === undefined || file === "") && !hasSuiteConfig)
|
|
129
|
+
return;
|
|
130
|
+
loaded ??= applyBootstrap(file ?? "", suite);
|
|
131
|
+
return loaded;
|
|
132
|
+
}
|
|
133
|
+
async function applyBootstrap(file, suite) {
|
|
134
|
+
const module = file === "" ? {} : readModule(await import(pathToFileURL(file).href));
|
|
135
|
+
// `runnerHooks` belong to the run, not to this file. When the parent ran
|
|
136
|
+
// them — which it does whenever a bootstrap exists — the worker must not run
|
|
137
|
+
// them again: that is the difference between migrating once and migrating
|
|
138
|
+
// once per test file.
|
|
139
|
+
const parentRanThem = globalHooksHandledByParent();
|
|
140
|
+
const setup = parentRanThem ? [] : [...(module.runnerHooks?.setup ?? [])];
|
|
141
|
+
const teardown = parentRanThem
|
|
142
|
+
? []
|
|
143
|
+
: [...(module.runnerHooks?.teardown ?? [])];
|
|
144
|
+
// `configureSuite` is handed to `configure()` rather than called here, so it
|
|
145
|
+
// runs where Japa runs it: after the plugins, which is what lets a plugin
|
|
146
|
+
// read it or replace it. The per-suite callback chains onto it — both get
|
|
147
|
+
// the same handle, so hooks either registers reach the arrays below.
|
|
148
|
+
await configure({
|
|
149
|
+
plugins: module.plugins,
|
|
150
|
+
filters: module.filters,
|
|
151
|
+
importer: module.importer,
|
|
152
|
+
configureSuite: async (handle) => {
|
|
153
|
+
module.configureSuite?.(handle);
|
|
154
|
+
await applySuiteConfigure(suite, handle);
|
|
155
|
+
},
|
|
156
|
+
setup,
|
|
157
|
+
teardown,
|
|
158
|
+
suite,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/** Test seam: forget that a bootstrap was loaded in this process. */
|
|
162
|
+
export function resetBootstrap() {
|
|
163
|
+
loaded = undefined;
|
|
164
|
+
resetTaps();
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/runtime/bootstrap.ts"],"names":[],"mappings":"AAAA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Ac,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YAChC,MAAM,CAAC,cAAc,EAAE,CAAC,MAAM,CAAC,CAAC;YAChC,MAAM,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC1C,CAAC;QACD,KAAK;QACL,QAAQ;QACR,KAAK;KACL,CAAC,CAAC;AACJ,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,cAAc;IAC7B,MAAM,GAAG,SAAS,CAAC;IACnB,SAAS,EAAE,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run's command-line arguments, as seen from inside a worker.
|
|
3
|
+
*
|
|
4
|
+
* `bin/helix.js` parses the flags in the CLI process and forwards them to every
|
|
5
|
+
* worker through the environment (`HELIX_TAGS`, `HELIX_TESTS`, …), because a
|
|
6
|
+
* worker is spawned by either orchestrator (Node pool or the Rust engine) with
|
|
7
|
+
* a fixed instruction shape. Reading them back here is what lets both the
|
|
8
|
+
* runtime and a plugin (`api.cliArgs`, Japa parity) see the same filters.
|
|
9
|
+
*
|
|
10
|
+
* One named deviation from Japa's `CLIArgs`: values are parsed (`string[]`,
|
|
11
|
+
* `number`, `boolean`) rather than kept as raw CLI strings. They have been
|
|
12
|
+
* through the parser once already, on the CLI side, and handing a plugin
|
|
13
|
+
* `"500"` to re-parse would be worse — Japa's own raw form exists because its
|
|
14
|
+
* CLI hands the config manager unparsed argv, which helix's does not.
|
|
15
|
+
*/
|
|
16
|
+
/** Parsed CLI flags for the current run. */
|
|
17
|
+
export interface CLIArgs {
|
|
18
|
+
/** Positionals — the paths or suite names typed on the command line. */
|
|
19
|
+
_?: string[];
|
|
20
|
+
/** `--list-pinned` — collect and print the pinned tests, run nothing. */
|
|
21
|
+
listPinned?: boolean;
|
|
22
|
+
/** `--tags` — `~@tag`/`!@tag` entries exclude. */
|
|
23
|
+
tags?: string[];
|
|
24
|
+
/** `--tests` — exact test titles. */
|
|
25
|
+
tests?: string[];
|
|
26
|
+
/** `--groups` — exact group titles. */
|
|
27
|
+
groups?: string[];
|
|
28
|
+
/** `--match-all` — require every `--tags` entry instead of any. */
|
|
29
|
+
matchAll?: boolean;
|
|
30
|
+
/** `--timeout`, in ms. */
|
|
31
|
+
timeout?: number;
|
|
32
|
+
/** `--retries` — extra attempts on failure. */
|
|
33
|
+
retries?: number;
|
|
34
|
+
/** `--grep` — helix extra: regex/substring over the full test name. */
|
|
35
|
+
grep?: string;
|
|
36
|
+
/** `--suite` — the suite name these files belong to. */
|
|
37
|
+
suite?: string;
|
|
38
|
+
/** `--files` — substrings matched against the test file path (Japa `--files`). */
|
|
39
|
+
files?: string[];
|
|
40
|
+
/** `--reporters` — the reporters activated for this run. */
|
|
41
|
+
reporters?: string[];
|
|
42
|
+
/** `--bail` — stop at the first failure. */
|
|
43
|
+
bail?: boolean;
|
|
44
|
+
/** `--bail-layer` — how far a bail reaches. */
|
|
45
|
+
bailLayer?: string;
|
|
46
|
+
/** `--failed` — this run replays the previous run's failures. */
|
|
47
|
+
failed?: boolean;
|
|
48
|
+
/** `--force-exit` — the CLI will `process.exit()` once the run ends. */
|
|
49
|
+
forceExit?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* `--help`. Always absent in a worker: the CLI prints its help and exits
|
|
52
|
+
* before spawning anything, so nothing here could ever have seen it. Declared
|
|
53
|
+
* for the same reason Japa declares it — a plugin reading `cliArgs.help`
|
|
54
|
+
* should get `undefined`, not a type error.
|
|
55
|
+
*/
|
|
56
|
+
help?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Japa's open record. A host that forwards its own `HELIX_*` variable, or a
|
|
59
|
+
* plugin that stashes something for another, has somewhere to put it without
|
|
60
|
+
* the type standing in the way.
|
|
61
|
+
*/
|
|
62
|
+
[flag: string]: string | string[] | number | boolean | undefined;
|
|
63
|
+
}
|
|
64
|
+
/** Comma-separated env list → trimmed non-empty entries, or undefined. */
|
|
65
|
+
export declare function envList(name: string): string[] | undefined;
|
|
66
|
+
/** A non-negative integer env var, or undefined when unset/invalid. */
|
|
67
|
+
export declare function envCount(name: string): number | undefined;
|
|
68
|
+
/** `--tags` as forwarded by the CLI. */
|
|
69
|
+
export declare function envTags(): string[] | undefined;
|
|
70
|
+
/** `--match-all` as forwarded by the CLI. */
|
|
71
|
+
export declare function envMatchAll(): boolean | undefined;
|
|
72
|
+
export declare function cliArgs(): CLIArgs;
|
|
73
|
+
/** Test seam: rebuild from the environment on the next access. */
|
|
74
|
+
export declare function resetCLIArgs(): void;
|
|
75
|
+
/** Every CLI flag the current worker can see, read fresh from the environment. */
|
|
76
|
+
export declare function readCLIArgs(): CLIArgs;
|
|
77
|
+
//# sourceMappingURL=cli-args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-args.d.ts","sourceRoot":"","sources":["../../src/runtime/cli-args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,4CAA4C;AAC5C,MAAM,WAAW,OAAO;IACvB,wEAAwE;IACxE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;IACb,yEAAyE;IACzE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,4CAA4C;IAC5C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACjE;AAED,0EAA0E;AAC1E,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAQ1D;AAED,uEAAuE;AACvE,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKzD;AAED,wCAAwC;AACxC,wBAAgB,OAAO,IAAI,MAAM,EAAE,GAAG,SAAS,CAE9C;AAED,6CAA6C;AAC7C,wBAAgB,WAAW,IAAI,OAAO,GAAG,SAAS,CAEjD;AAiBD,wBAAgB,OAAO,IAAI,OAAO,CAGjC;AAED,kEAAkE;AAClE,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,kFAAkF;AAClF,wBAAgB,WAAW,IAAI,OAAO,CAmBrC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run's command-line arguments, as seen from inside a worker.
|
|
3
|
+
*
|
|
4
|
+
* `bin/helix.js` parses the flags in the CLI process and forwards them to every
|
|
5
|
+
* worker through the environment (`HELIX_TAGS`, `HELIX_TESTS`, …), because a
|
|
6
|
+
* worker is spawned by either orchestrator (Node pool or the Rust engine) with
|
|
7
|
+
* a fixed instruction shape. Reading them back here is what lets both the
|
|
8
|
+
* runtime and a plugin (`api.cliArgs`, Japa parity) see the same filters.
|
|
9
|
+
*
|
|
10
|
+
* One named deviation from Japa's `CLIArgs`: values are parsed (`string[]`,
|
|
11
|
+
* `number`, `boolean`) rather than kept as raw CLI strings. They have been
|
|
12
|
+
* through the parser once already, on the CLI side, and handing a plugin
|
|
13
|
+
* `"500"` to re-parse would be worse — Japa's own raw form exists because its
|
|
14
|
+
* CLI hands the config manager unparsed argv, which helix's does not.
|
|
15
|
+
*/
|
|
16
|
+
/** Comma-separated env list → trimmed non-empty entries, or undefined. */
|
|
17
|
+
export function envList(name) {
|
|
18
|
+
const raw = process.env[name];
|
|
19
|
+
if (raw === undefined || raw === "")
|
|
20
|
+
return undefined;
|
|
21
|
+
const items = raw
|
|
22
|
+
.split(",")
|
|
23
|
+
.map((t) => t.trim())
|
|
24
|
+
.filter((t) => t.length > 0);
|
|
25
|
+
return items.length > 0 ? items : undefined;
|
|
26
|
+
}
|
|
27
|
+
/** A non-negative integer env var, or undefined when unset/invalid. */
|
|
28
|
+
export function envCount(name) {
|
|
29
|
+
const raw = process.env[name];
|
|
30
|
+
if (raw === undefined || raw === "")
|
|
31
|
+
return undefined;
|
|
32
|
+
const n = Number.parseInt(raw, 10);
|
|
33
|
+
return Number.isFinite(n) && n >= 0 ? n : undefined;
|
|
34
|
+
}
|
|
35
|
+
/** `--tags` as forwarded by the CLI. */
|
|
36
|
+
export function envTags() {
|
|
37
|
+
return envList("HELIX_TAGS");
|
|
38
|
+
}
|
|
39
|
+
/** `--match-all` as forwarded by the CLI. */
|
|
40
|
+
export function envMatchAll() {
|
|
41
|
+
return process.env.HELIX_MATCH_ALL === "1" ? true : undefined;
|
|
42
|
+
}
|
|
43
|
+
/** A boolean flag as forwarded by the CLI — absent stays `undefined`, as in Japa. */
|
|
44
|
+
function envFlag(name) {
|
|
45
|
+
return process.env[name] === "1" ? true : undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The run's flags, as ONE object.
|
|
49
|
+
*
|
|
50
|
+
* Japa hands its plugins a `cliArgs` they may edit — that is a documented way
|
|
51
|
+
* to steer a run from a plugin. Rebuilding it from the environment on every
|
|
52
|
+
* access would silently drop those edits, so it is built once and every reader
|
|
53
|
+
* (the plugin API, and the runtime's own filter resolution) shares it.
|
|
54
|
+
*/
|
|
55
|
+
let materialised;
|
|
56
|
+
export function cliArgs() {
|
|
57
|
+
materialised ??= readCLIArgs();
|
|
58
|
+
return materialised;
|
|
59
|
+
}
|
|
60
|
+
/** Test seam: rebuild from the environment on the next access. */
|
|
61
|
+
export function resetCLIArgs() {
|
|
62
|
+
materialised = undefined;
|
|
63
|
+
}
|
|
64
|
+
/** Every CLI flag the current worker can see, read fresh from the environment. */
|
|
65
|
+
export function readCLIArgs() {
|
|
66
|
+
return {
|
|
67
|
+
tags: envTags(),
|
|
68
|
+
tests: envList("HELIX_TESTS"),
|
|
69
|
+
groups: envList("HELIX_GROUPS"),
|
|
70
|
+
matchAll: envMatchAll(),
|
|
71
|
+
timeout: envCount("HELIX_TIMEOUT"),
|
|
72
|
+
retries: envCount("HELIX_RETRIES"),
|
|
73
|
+
grep: process.env.HELIX_GREP,
|
|
74
|
+
suite: process.env.HELIX_SUITE,
|
|
75
|
+
files: envList("HELIX_FILES"),
|
|
76
|
+
reporters: envList("HELIX_REPORTERS"),
|
|
77
|
+
bail: envFlag("HELIX_BAIL"),
|
|
78
|
+
bailLayer: process.env.HELIX_BAIL_LAYER,
|
|
79
|
+
failed: envFlag("HELIX_FAILED"),
|
|
80
|
+
forceExit: envFlag("HELIX_FORCE_EXIT"),
|
|
81
|
+
listPinned: envFlag("HELIX_LIST_PINNED"),
|
|
82
|
+
_: envList("HELIX_POSITIONALS"),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=cli-args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-args.js","sourceRoot":"","sources":["../../src/runtime/cli-args.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAmDH,0EAA0E;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{ FRAME_PREFIX, PRE_HANDSHAKE_NONCE } from "./ipc-protocol.js";
|
|
26
27
|
import { runTestFile } from "./worker.js";
|
|
27
|
-
const FRAME_PREFIX = "__HELIX_RESULT__";
|
|
28
|
-
const PRE_HANDSHAKE_NONCE = "__helix_pre_handshake__";
|
|
29
28
|
async function emit(msg) {
|
|
30
29
|
const line = `${FRAME_PREFIX}${JSON.stringify(msg)}\n`;
|
|
31
30
|
await new Promise((resolve, reject) => {
|
|
@@ -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,
|
|
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,C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