@c9up/helix 0.1.8 → 0.1.9
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 +185 -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 +12 -0
- 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/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/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/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/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 +85 -28
- 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,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `runnerHooks` — run ONCE for the whole run, where Japa runs them.
|
|
3
|
+
*
|
|
4
|
+
* These were running per worker process, which meant a migration in
|
|
5
|
+
* `runnerHooks.setup` ran once per FILE. The reason given was that a resource
|
|
6
|
+
* opened in the CLI process would not exist in the workers — true of an
|
|
7
|
+
* in-memory one, and false of everything these hooks actually do: migrate a
|
|
8
|
+
* database, seed it, start a server on a port, create a directory. Those cross
|
|
9
|
+
* processes, and running them N times is wrong, not merely wasteful.
|
|
10
|
+
*
|
|
11
|
+
* So they run here, in the process that spawns the workers, and the workers are
|
|
12
|
+
* told to skip them. What genuinely has to exist INSIDE a worker — a context
|
|
13
|
+
* macro, anything held in memory — is what `plugins` are for, and those still
|
|
14
|
+
* run per worker because they have to.
|
|
15
|
+
*/
|
|
16
|
+
/** Set for the workers, so they do not run what the parent already ran. */
|
|
17
|
+
export declare const GLOBAL_HOOKS_ENV = "HELIX_GLOBAL_HOOKS";
|
|
18
|
+
/** Whether this process should skip `runnerHooks` because a parent ran them. */
|
|
19
|
+
export declare function globalHooksHandledByParent(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Run the bootstrap's `runnerHooks.setup` once and return the teardown for the
|
|
22
|
+
* end of the run. Undos a setup hook resolved to unwind first, then the
|
|
23
|
+
* declared teardowns — both in reverse order, as everywhere else.
|
|
24
|
+
*
|
|
25
|
+
* A no-op returning a no-op when the project has no bootstrap: there is then
|
|
26
|
+
* nothing to run once, and the workers have nothing to skip.
|
|
27
|
+
*/
|
|
28
|
+
export declare function runGlobalHooks(bootstrap: string | undefined, options?: {
|
|
29
|
+
japaPlugins?: boolean;
|
|
30
|
+
}): Promise<() => Promise<void>>;
|
|
31
|
+
//# sourceMappingURL=global-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-hooks.d.ts","sourceRoot":"","sources":["../../src/runtime/global-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,uBAAuB,CAAC;AAErD,gFAAgF;AAChF,wBAAgB,0BAA0B,IAAI,OAAO,CAEpD;AASD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CACnC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,GACrC,OAAO,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAyD9B"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `runnerHooks` — run ONCE for the whole run, where Japa runs them.
|
|
3
|
+
*
|
|
4
|
+
* These were running per worker process, which meant a migration in
|
|
5
|
+
* `runnerHooks.setup` ran once per FILE. The reason given was that a resource
|
|
6
|
+
* opened in the CLI process would not exist in the workers — true of an
|
|
7
|
+
* in-memory one, and false of everything these hooks actually do: migrate a
|
|
8
|
+
* database, seed it, start a server on a port, create a directory. Those cross
|
|
9
|
+
* processes, and running them N times is wrong, not merely wasteful.
|
|
10
|
+
*
|
|
11
|
+
* So they run here, in the process that spawns the workers, and the workers are
|
|
12
|
+
* told to skip them. What genuinely has to exist INSIDE a worker — a context
|
|
13
|
+
* macro, anything held in memory — is what `plugins` are for, and those still
|
|
14
|
+
* run per worker because they have to.
|
|
15
|
+
*/
|
|
16
|
+
import { pathToFileURL } from "node:url";
|
|
17
|
+
import { emitter } from "./emitter.js";
|
|
18
|
+
import { Runner } from "./runner.js";
|
|
19
|
+
/** Set for the workers, so they do not run what the parent already ran. */
|
|
20
|
+
export const GLOBAL_HOOKS_ENV = "HELIX_GLOBAL_HOOKS";
|
|
21
|
+
/** Whether this process should skip `runnerHooks` because a parent ran them. */
|
|
22
|
+
export function globalHooksHandledByParent() {
|
|
23
|
+
return process.env[GLOBAL_HOOKS_ENV] === "1";
|
|
24
|
+
}
|
|
25
|
+
function hookList(source, key) {
|
|
26
|
+
if (source === null || typeof source !== "object")
|
|
27
|
+
return [];
|
|
28
|
+
const value = Reflect.get(source, key);
|
|
29
|
+
if (!Array.isArray(value))
|
|
30
|
+
return [];
|
|
31
|
+
return value.filter((fn) => typeof fn === "function");
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Run the bootstrap's `runnerHooks.setup` once and return the teardown for the
|
|
35
|
+
* end of the run. Undos a setup hook resolved to unwind first, then the
|
|
36
|
+
* declared teardowns — both in reverse order, as everywhere else.
|
|
37
|
+
*
|
|
38
|
+
* A no-op returning a no-op when the project has no bootstrap: there is then
|
|
39
|
+
* nothing to run once, and the workers have nothing to skip.
|
|
40
|
+
*/
|
|
41
|
+
export async function runGlobalHooks(bootstrap, options = {}) {
|
|
42
|
+
if (bootstrap === undefined || bootstrap === "") {
|
|
43
|
+
return async () => { };
|
|
44
|
+
}
|
|
45
|
+
// The parent imports the bootstrap too, so it needs the same alias the
|
|
46
|
+
// workers get. Without it the two processes resolve `@japa/runner/core`
|
|
47
|
+
// differently — the parent to the real Japa, the workers to the shim — and a
|
|
48
|
+
// bootstrap that registers at the top level registers on a class nothing
|
|
49
|
+
// reads. When `@japa/runner` is not installed at all, the parent simply
|
|
50
|
+
// cannot import the file.
|
|
51
|
+
let dropAlias;
|
|
52
|
+
if (options.japaPlugins === true) {
|
|
53
|
+
const { setJapaAlias } = await import("../japa/japa-alias.mjs");
|
|
54
|
+
setJapaAlias(true);
|
|
55
|
+
// Turned off with the teardown: `register()` cannot be undone, so a host
|
|
56
|
+
// running twice in one process would otherwise keep resolving
|
|
57
|
+
// `@japa/runner/core` to the shim after asking for the real one.
|
|
58
|
+
dropAlias = () => setJapaAlias(false);
|
|
59
|
+
}
|
|
60
|
+
// Everything past the alias needs unwinding if it throws: the import can
|
|
61
|
+
// fail, and so can a setup hook — half-way through, with earlier hooks
|
|
62
|
+
// already having opened something. Leaving the alias on and the undos
|
|
63
|
+
// pending is the failure mode this whole file exists to avoid.
|
|
64
|
+
const previous = process.env[GLOBAL_HOOKS_ENV];
|
|
65
|
+
const runner = new Runner(emitter);
|
|
66
|
+
const undos = [];
|
|
67
|
+
let teardown = [];
|
|
68
|
+
try {
|
|
69
|
+
const module = await import(pathToFileURL(bootstrap).href);
|
|
70
|
+
const hooks = Reflect.get(Object(module), "runnerHooks");
|
|
71
|
+
const setup = hookList(hooks, "setup");
|
|
72
|
+
teardown = hookList(hooks, "teardown");
|
|
73
|
+
for (const fn of setup) {
|
|
74
|
+
const undo = await fn(runner);
|
|
75
|
+
if (typeof undo === "function")
|
|
76
|
+
undos.push(undo);
|
|
77
|
+
}
|
|
78
|
+
if (setup.length > 0 || teardown.length > 0) {
|
|
79
|
+
process.env[GLOBAL_HOOKS_ENV] = "1";
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
// Unwind what did run, then hand the failure on: a run that could not set
|
|
84
|
+
// itself up must not start, and must not leave the process changed.
|
|
85
|
+
await unwind(undos, [], runner);
|
|
86
|
+
dropAlias?.();
|
|
87
|
+
restoreEnv(previous);
|
|
88
|
+
throw err;
|
|
89
|
+
}
|
|
90
|
+
return async () => {
|
|
91
|
+
dropAlias?.();
|
|
92
|
+
restoreEnv(previous);
|
|
93
|
+
await unwind(undos, teardown, runner);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/** Put `HELIX_GLOBAL_HOOKS` back the way it was found. */
|
|
97
|
+
function restoreEnv(previous) {
|
|
98
|
+
if (previous === undefined)
|
|
99
|
+
delete process.env[GLOBAL_HOOKS_ENV];
|
|
100
|
+
else
|
|
101
|
+
process.env[GLOBAL_HOOKS_ENV] = previous;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Unwind what a setup opened: the undos it resolved to, then the declared
|
|
105
|
+
* teardowns, both in reverse. Failures are reported rather than thrown — one
|
|
106
|
+
* broken teardown must not hide the rest, nor turn a finished run red.
|
|
107
|
+
*/
|
|
108
|
+
async function unwind(undos, teardown, runner) {
|
|
109
|
+
for (let i = undos.length - 1; i >= 0; i -= 1) {
|
|
110
|
+
try {
|
|
111
|
+
await undos[i](null, runner);
|
|
112
|
+
}
|
|
113
|
+
catch (err) {
|
|
114
|
+
console.error("[helix] global cleanup failed:", err);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
for (let i = teardown.length - 1; i >= 0; i -= 1) {
|
|
118
|
+
try {
|
|
119
|
+
await teardown[i](runner);
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
console.error("[helix] global teardown failed:", err);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=global-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-hooks.js","sourceRoot":"","sources":["../../src/runtime/global-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,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C;QACrB,MAAM,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC,CAAC;AACH,CAAC;AAED,0DAA0D;AAC1D,SAAS,UAAU,CAAC,QAA4B;IAC/C,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;;QAC5D,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,MAAM,CACpB,KAAyB,EACzB,QAAqB,EACrB,MAAc;IAEd,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,IAAI,CAAC;YACJ,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC9B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;QACtD,CAAC;IACF,CAAC;IACD,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,IAAI,CAAC;YACJ,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,GAAG,CAAC,CAAC;QACvD,CAAC;IACF,CAAC;AACF,CAAC"}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -5,9 +5,18 @@
|
|
|
5
5
|
* get the full DSL. The runtime is orchestrator-agnostic: a Node child
|
|
6
6
|
* process, a Bun worker, or a Rust-spawned worker all load the same module.
|
|
7
7
|
*/
|
|
8
|
+
export type { Assert } from "./assert.js";
|
|
9
|
+
export { createAssert } from "./assert.js";
|
|
8
10
|
export type { AssertionErrorInit } from "./assertion-error.js";
|
|
9
11
|
export { AssertionError, isAssertionError } from "./assertion-error.js";
|
|
10
12
|
export type { AsymmetricMatcher, Constructor } from "./asymmetric.js";
|
|
13
|
+
export type { CLIArgs } from "./cli-args.js";
|
|
14
|
+
export type { ConfigureOptions, Plugin, PluginApi, PluginContext, RunnerHook, } from "./configure.js";
|
|
15
|
+
export { configure, drainRunnerTeardowns } from "./configure.js";
|
|
16
|
+
export type { Getter } from "./context.js";
|
|
17
|
+
export { buildTestContext, TestContext, TestContextRegistry, } from "./context.js";
|
|
18
|
+
export type { EmittedDataset, EmittedError, EmittedTitle, ErrorPhase, EventHandler, GroupEndNode, GroupStartNode, RunnerEndNode, RunnerEvents, RunnerStartNode, SuiteEndNode, SuiteStartNode, TestEndNode, TestStartNode, } from "./emitter.js";
|
|
19
|
+
export { Emitter, emitter } from "./emitter.js";
|
|
11
20
|
export type { EqualsOptions } from "./equals.js";
|
|
12
21
|
export { equals, partialEquals } from "./equals.js";
|
|
13
22
|
export type { Assertion, ExpectStatic } from "./expect.js";
|
|
@@ -18,9 +27,11 @@ export type { MatcherName, MatcherResult, SpyLike } from "./matchers.js";
|
|
|
18
27
|
export { matchers } from "./matchers.js";
|
|
19
28
|
export type { FileResult, SerializedError, SuiteResult, TestResult, } from "./run.js";
|
|
20
29
|
export { executeRoot } from "./run.js";
|
|
21
|
-
export type {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
30
|
+
export type { RunnerSummary, SummaryAggregates } from "./runner.js";
|
|
31
|
+
export { Runner } from "./runner.js";
|
|
32
|
+
export type { CleanupFn, DatasetHandle, DatasetSource, DoneFn, Group, GroupInstance, HookFn, RunMode, SuiteNode, TapHandle, TapOptions, TestFn, TestHandle, TestInstance, TestNode, TestOptions, } from "./suite.js";
|
|
33
|
+
export { describe, getRoot, it, resetRoot, Test, test, } from "./suite.js";
|
|
34
|
+
export { getActiveTest, getActiveTestOrFail, onTestFailed, onTestFinished, } from "./test-context.js";
|
|
24
35
|
export type { Vi } from "./vi/index.js";
|
|
25
36
|
export { vi, withViContext } from "./vi/index.js";
|
|
26
37
|
export type { CreateSpyOptions, MockCallResult, MockInternals, Spy, } from "./vi/spy.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACpD,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACN,OAAO,EACP,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,GACV,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EACX,UAAU,EACV,eAAe,EACf,WAAW,EACX,UAAU,GACV,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,YAAY,EACX,SAAS,EACT,MAAM,EACN,OAAO,EACP,SAAS,EACT,MAAM,EACN,UAAU,EACV,QAAQ,EACR,WAAW,G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AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/runtime/index.js
CHANGED
|
@@ -5,14 +5,19 @@
|
|
|
5
5
|
* get the full DSL. The runtime is orchestrator-agnostic: a Node child
|
|
6
6
|
* process, a Bun worker, or a Rust-spawned worker all load the same module.
|
|
7
7
|
*/
|
|
8
|
+
export { createAssert } from "./assert.js";
|
|
8
9
|
export { AssertionError, isAssertionError } from "./assertion-error.js";
|
|
10
|
+
export { configure, drainRunnerTeardowns } from "./configure.js";
|
|
11
|
+
export { buildTestContext, TestContext, TestContextRegistry, } from "./context.js";
|
|
12
|
+
export { Emitter, emitter } from "./emitter.js";
|
|
9
13
|
export { equals, partialEquals } from "./equals.js";
|
|
10
14
|
export { expect } from "./expect.js";
|
|
11
15
|
export { addHook, afterAll, afterEach, beforeAll, beforeEach, } from "./lifecycle.js";
|
|
12
16
|
export { matchers } from "./matchers.js";
|
|
13
17
|
export { executeRoot } from "./run.js";
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
18
|
+
export { Runner } from "./runner.js";
|
|
19
|
+
export { describe, getRoot, it, resetRoot, Test, test, } from "./suite.js";
|
|
20
|
+
export { getActiveTest, getActiveTestOrFail, onTestFailed, onTestFinished, } from "./test-context.js";
|
|
16
21
|
export { vi, withViContext } from "./vi/index.js";
|
|
17
22
|
export { runTestFile } from "./worker.js";
|
|
18
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAUxE,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EACN,gBAAgB,EAChB,WAAW,EACX,mBAAmB,GACnB,MAAM,cAAc,CAAC;AAiBtB,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,EACN,OAAO,EACP,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,GACV,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOzC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAmBrC,OAAO,EACN,QAAQ,EACR,OAAO,EACP,EAAE,EACF,SAAS,EACT,IAAI,EACJ,IAAI,GACJ,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,cAAc,GACd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AASlD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/runtime/run.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* `.only` handling: if any test or suite is marked `only` anywhere in the
|
|
7
7
|
* tree, non-`only` paths are downgraded to `skip` before execution.
|
|
8
8
|
*/
|
|
9
|
+
import { type ErrorPhase } from "./emitter.js";
|
|
9
10
|
import type { SuiteNode } from "./suite.js";
|
|
10
11
|
export interface TestResult {
|
|
11
12
|
name: string;
|
|
@@ -13,6 +14,8 @@ export interface TestResult {
|
|
|
13
14
|
status: "pass" | "fail" | "skip" | "todo";
|
|
14
15
|
durationMs: number;
|
|
15
16
|
error?: SerializedError;
|
|
17
|
+
/** Lifecycle phase `error` was raised in (Japa `test:end` parity). */
|
|
18
|
+
errorPhase?: ErrorPhase;
|
|
16
19
|
}
|
|
17
20
|
export interface SuiteResult {
|
|
18
21
|
name: string;
|
|
@@ -42,6 +45,12 @@ export interface FileResult {
|
|
|
42
45
|
todo: number;
|
|
43
46
|
};
|
|
44
47
|
durationMs: number;
|
|
48
|
+
/**
|
|
49
|
+
* Full names of the tests marked `.pin()` — only populated under
|
|
50
|
+
* `--list-pinned`, where Japa collects the files, prints what is pinned, and
|
|
51
|
+
* runs nothing.
|
|
52
|
+
*/
|
|
53
|
+
pinned?: string[];
|
|
45
54
|
}
|
|
46
55
|
export interface ExecuteOptions {
|
|
47
56
|
/**
|
|
@@ -61,10 +70,48 @@ export interface ExecuteOptions {
|
|
|
61
70
|
*/
|
|
62
71
|
grep?: string;
|
|
63
72
|
/**
|
|
64
|
-
* Tag filter expressions (
|
|
65
|
-
*
|
|
73
|
+
* Tag filter expressions (Japa `--tags`). A `~`-prefixed tag EXCLUDES (`!` is
|
|
74
|
+
* also accepted). Required tags are OR-ed by default — a test runs when it
|
|
75
|
+
* carries ANY of them — unless {@link ExecuteOptions.matchAll} is set, and
|
|
76
|
+
* never when it carries an excluded tag.
|
|
66
77
|
*/
|
|
67
78
|
tags?: string[];
|
|
79
|
+
/** Require ALL required tags instead of any (Japa `--match-all`). */
|
|
80
|
+
matchAll?: boolean;
|
|
81
|
+
/** Exact test titles to run (Japa `--tests`). A test runs only if its leaf title is listed. */
|
|
82
|
+
tests?: string[];
|
|
83
|
+
/** Exact group titles to run (Japa `--groups`). A test runs only if its enclosing group is listed. */
|
|
84
|
+
groups?: string[];
|
|
85
|
+
/**
|
|
86
|
+
* The suite these tests belong to — `ctx.test.options.meta.suite.name` and the
|
|
87
|
+
* `suite:*` event payloads. Defaults to `"default"`, Japa's implicit suite.
|
|
88
|
+
*/
|
|
89
|
+
suite?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Stop running once a test fails (Japa `--bail`). Everything after the
|
|
92
|
+
* failure is reported as SKIPPED, not dropped — same as Japa, so the counts
|
|
93
|
+
* still add up.
|
|
94
|
+
*/
|
|
95
|
+
bail?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* How far a bail reaches (Japa `--bail-layer`): `"group"` stops the enclosing
|
|
98
|
+
* group only, `"suite"` the rest of the file, `"runner"` (Japa's default,
|
|
99
|
+
* spelled `""` on its CLI) the rest of the run — the remaining FILES are
|
|
100
|
+
* dropped by the pool, since helix runs one process per file and cannot skip
|
|
101
|
+
* tests it never collected.
|
|
102
|
+
*/
|
|
103
|
+
bailLayer?: "group" | "suite" | "runner" | "";
|
|
104
|
+
}
|
|
105
|
+
/** The value a {@link SerializedError} was built from, when it is still around. */
|
|
106
|
+
export declare function thrownValue(error: SerializedError): unknown;
|
|
107
|
+
/**
|
|
108
|
+
* The suite a run belongs to (Japa `meta.suite`). Helix runs one process per
|
|
109
|
+
* FILE, so the suite is a name the run carries — `"default"` unless
|
|
110
|
+
* `configure({ suite })` or `--suite` says otherwise, exactly like Japa's
|
|
111
|
+
* implicit suite.
|
|
112
|
+
*/
|
|
113
|
+
export interface SuiteIdentity {
|
|
114
|
+
name: string;
|
|
68
115
|
}
|
|
69
116
|
export declare function executeRoot(root: SuiteNode, file: string, options?: ExecuteOptions): Promise<FileResult>;
|
|
70
117
|
//# sourceMappingURL=run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/runtime/run.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/runtime/run.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAGN,KAAK,UAAU,EAGf,MAAM,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