@overkill-dev/engine 0.0.23 → 0.0.25
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/assertion-protocol/assertion-node-shape.d.ts +4 -3
- package/assertion-protocol/assertion-node-shape.d.ts.map +1 -1
- package/assertion-protocol/assertion-node.d.ts +2 -2
- package/assertion-protocol/assertion-node.d.ts.map +1 -1
- package/assertion-protocol/assertion-reference.d.ts +2 -2
- package/assertion-protocol/assertion-reference.d.ts.map +1 -1
- package/assertion-protocol/assertions/collection.d.ts +2 -2
- package/assertion-protocol/assertions/collection.d.ts.map +1 -1
- package/assertion-protocol/assertions/fail.d.ts +2 -2
- package/assertion-protocol/assertions/fail.d.ts.map +1 -1
- package/assertion-protocol/assertions/numeric.d.ts +2 -2
- package/assertion-protocol/assertions/numeric.d.ts.map +1 -1
- package/assertion-protocol/assertions/string.d.ts +2 -2
- package/assertion-protocol/assertions/string.d.ts.map +1 -1
- package/assertion-protocol/assertions/type-shape.d.ts +3 -3
- package/assertion-protocol/assertions/type-shape.d.ts.map +1 -1
- package/assertion-protocol/evaluation.d.ts.map +1 -1
- package/assertion-protocol/evaluation.js +8 -3
- package/assertion-protocol/evaluation.js.map +1 -1
- package/assertion-protocol/source-location-forwarding.d.ts +4 -0
- package/assertion-protocol/source-location-forwarding.d.ts.map +1 -0
- package/assertion-protocol/source-location-forwarding.js +26 -0
- package/assertion-protocol/source-location-forwarding.js.map +1 -0
- package/assertion-protocol/source-location.d.ts.map +1 -1
- package/assertion-protocol/source-location.js +1 -0
- package/assertion-protocol/source-location.js.map +1 -1
- package/assertion-protocol/thrown-matcher.d.ts +2 -2
- package/assertion-protocol/thrown-matcher.d.ts.map +1 -1
- package/assertion-protocol/thrown-matcher.js +23 -23
- package/assertion-protocol/thrown-matcher.js.map +1 -1
- package/engine/assertion-facade.d.ts.map +1 -1
- package/engine/assertion-facade.js +5 -4
- package/engine/assertion-facade.js.map +1 -1
- package/engine/custom-assertion-recording.d.ts +3 -3
- package/engine/custom-assertion-recording.d.ts.map +1 -1
- package/engine/custom-assertion-recording.js +19 -19
- package/engine/custom-assertion-recording.js.map +1 -1
- package/engine/engine.d.ts +0 -5
- package/engine/engine.d.ts.map +1 -1
- package/engine/engine.js +1 -11
- package/engine/engine.js.map +1 -1
- package/engine/execution-result.js +8 -3
- package/engine/execution-result.js.map +1 -1
- package/engine/execution.d.ts.map +1 -1
- package/engine/execution.js +9 -2
- package/engine/execution.js.map +1 -1
- package/engine/identity.d.ts +2 -2
- package/engine/identity.d.ts.map +1 -1
- package/engine/identity.js +6 -6
- package/engine/identity.js.map +1 -1
- package/engine/reporter.d.ts +10 -3
- package/engine/reporter.d.ts.map +1 -1
- package/engine/reporter.js.map +1 -1
- package/engine/require-assertion-facade.d.ts.map +1 -1
- package/engine/require-assertion-facade.js +25 -24
- package/engine/require-assertion-facade.js.map +1 -1
- package/engine/run-result.d.ts +2 -2
- package/engine/run-result.d.ts.map +1 -1
- package/engine/test-node.d.ts +19 -18
- package/engine/test-node.d.ts.map +1 -1
- package/engine/test-node.js +37 -23
- package/engine/test-node.js.map +1 -1
- package/engine/test-plan.d.ts +8 -5
- package/engine/test-plan.d.ts.map +1 -1
- package/engine/test-plan.js +43 -21
- package/engine/test-plan.js.map +1 -1
- package/package.json +2 -2
- package/packages/engine/assertion-protocol.entry-point.d.ts +1 -1
- package/packages/engine/assertion-protocol.entry-point.d.ts.map +1 -1
- package/packages/engine/assertion-protocol.entry-point.js.map +1 -1
- package/packages/engine/engine.entry-point.d.ts +3 -5
- package/packages/engine/engine.entry-point.d.ts.map +1 -1
- package/packages/engine/engine.entry-point.js +2 -13
- package/packages/engine/engine.entry-point.js.map +1 -1
- package/readme.md +22 -14
- package/sbom.cdx.json +4 -4
- package/engine/run-if-main.d.ts +0 -29
- package/engine/run-if-main.d.ts.map +0 -1
- package/engine/run-if-main.js +0 -46
- package/engine/run-if-main.js.map +0 -1
package/readme.md
CHANGED
|
@@ -10,14 +10,13 @@ Top-level API:
|
|
|
10
10
|
- `createTable(options)`
|
|
11
11
|
- `createTestPlan(root)`
|
|
12
12
|
- `execute(testPlan)`
|
|
13
|
-
- `runIfMain(import.meta, testNode, options?)`
|
|
14
13
|
- `createEngine()`
|
|
15
14
|
- `formatCaseId(caseId)`
|
|
16
15
|
- `validateReporterSinks(reporters)`
|
|
17
16
|
- `createPlainOutputRenderer()`
|
|
18
17
|
- `captureSourceLocation()`
|
|
19
18
|
- `unknownSourceLocation`
|
|
20
|
-
- `CaseId`, `TestId`, `TestRoot`, `TestPlan`, `ExecuteOptions`, `
|
|
19
|
+
- `CaseId`, `TestId`, `TestRoot`, `TestPlan`, `ExecuteOptions`, `NonEmptyReadonlyArray`, `DeepComparable`
|
|
21
20
|
- `Reporter`, `ReporterEvent`, `RealTimeReporter`, `FinalResultReporter`, `RunFacts`, `SinkDeclaration`, `OutputLineIntent`, `OutputRenderer`
|
|
22
21
|
- `RunResult`, `TestOutcome`, `PassOutcome`, `FailOutcome`, `SkipOutcome`, `InconclusiveOutcome`
|
|
23
22
|
- `AssertionNode`, `AssertionResult`, `AssertAssertionFacade`, `TestScopeAssertContext`
|
|
@@ -30,11 +29,10 @@ The top-level constructors share one default engine instance. Use
|
|
|
30
29
|
`createEngine()` when a collection needs isolated construction state for
|
|
31
30
|
`defined` counts and orphan detection.
|
|
32
31
|
|
|
33
|
-
Direct
|
|
32
|
+
Direct execution:
|
|
34
33
|
|
|
35
34
|
```ts
|
|
36
|
-
import { createTestCase,
|
|
37
|
-
import { createDotReporter } from '@overkill-dev/reporter-dot';
|
|
35
|
+
import { createRoot, createTestCase, createTestPlan, execute } from '@overkill-dev/engine';
|
|
38
36
|
|
|
39
37
|
export const testNode = createTestCase({
|
|
40
38
|
body(scope) {
|
|
@@ -45,17 +43,24 @@ export const testNode = createTestCase({
|
|
|
45
43
|
name: 'passes'
|
|
46
44
|
});
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
const root = createRoot({
|
|
47
|
+
children: [ testNode ],
|
|
48
|
+
metadata: { kind: 'microtest' },
|
|
49
|
+
name: 'direct'
|
|
51
50
|
});
|
|
51
|
+
|
|
52
|
+
await execute(createTestPlan(root));
|
|
52
53
|
```
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
Runner-owned direct Node entrypoints are exposed by `@overkill-dev/run` and
|
|
56
|
+
`@overkill-dev/test` through `runIfMain(import.meta, testNode, options?)`.
|
|
57
|
+
Those entrypoints load runner config, match the direct file to a profile, and
|
|
58
|
+
use default runner reporters when no explicit reporters are configured.
|
|
59
|
+
|
|
60
|
+
Aggregate direct execution:
|
|
55
61
|
|
|
56
62
|
```ts
|
|
57
|
-
import { createSuite,
|
|
58
|
-
import { createDotReporter } from '@overkill-dev/reporter-dot';
|
|
63
|
+
import { createRoot, createSuite, createTestPlan, execute } from '@overkill-dev/engine';
|
|
59
64
|
import { testNode as orders } from './orders.test.ts';
|
|
60
65
|
import { testNode as users } from './users.test.ts';
|
|
61
66
|
|
|
@@ -65,10 +70,13 @@ export const testNode = createSuite({
|
|
|
65
70
|
name: 'all'
|
|
66
71
|
});
|
|
67
72
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
const root = createRoot({
|
|
74
|
+
children: [ testNode ],
|
|
75
|
+
metadata: { kind: 'microtest' },
|
|
76
|
+
name: 'all'
|
|
71
77
|
});
|
|
78
|
+
|
|
79
|
+
await execute(createTestPlan(root));
|
|
72
80
|
```
|
|
73
81
|
|
|
74
82
|
Direct `createTestPlan(...)` calls require an explicit `createRoot(...)`.
|
package/sbom.cdx.json
CHANGED
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"component": {
|
|
17
17
|
"type": "library",
|
|
18
18
|
"name": "@overkill-dev/engine",
|
|
19
|
-
"version": "0.0.
|
|
20
|
-
"bom-ref": "pkg:npm/@overkill-dev/engine@0.0.
|
|
21
|
-
"purl": "pkg:npm/@overkill-dev/engine@0.0.
|
|
19
|
+
"version": "0.0.25",
|
|
20
|
+
"bom-ref": "pkg:npm/@overkill-dev/engine@0.0.25",
|
|
21
|
+
"purl": "pkg:npm/@overkill-dev/engine@0.0.25"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"components": [
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"ref": "pkg:npm/@enormora/wall-clock@0.0.3"
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
|
-
"ref": "pkg:npm/@overkill-dev/engine@0.0.
|
|
57
|
+
"ref": "pkg:npm/@overkill-dev/engine@0.0.25",
|
|
58
58
|
"dependsOn": [
|
|
59
59
|
"pkg:npm/@enormora/wall-clock@0.0.3",
|
|
60
60
|
"pkg:npm/diff@9.0.0"
|
package/engine/run-if-main.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { WallClock } from '@enormora/wall-clock';
|
|
2
|
-
import type { Execute } from './execution.ts';
|
|
3
|
-
import type { Metadata } from './metadata.ts';
|
|
4
|
-
import { type OutputRenderer } from './reporter-output.ts';
|
|
5
|
-
import type { Reporter, RunFacts } from './reporter.ts';
|
|
6
|
-
import type { RootOptions, TestNode, TestRoot } from './test-node.ts';
|
|
7
|
-
import type { TestPlanFactory } from './test-plan.ts';
|
|
8
|
-
export type RunIfMainOptions = {
|
|
9
|
-
readonly outputRenderer?: OutputRenderer;
|
|
10
|
-
readonly reporters?: readonly Reporter[];
|
|
11
|
-
readonly root?: RunIfMainRootOptions;
|
|
12
|
-
readonly runFacts?: RunFacts;
|
|
13
|
-
};
|
|
14
|
-
export type RunIfMainRootOptions = {
|
|
15
|
-
readonly metadata: Metadata;
|
|
16
|
-
readonly name: string;
|
|
17
|
-
};
|
|
18
|
-
export type RunIfMain = (meta: Readonly<ImportMeta>, testNode: TestNode, options?: RunIfMainOptions) => Promise<void>;
|
|
19
|
-
export type RunIfMainDependencies = {
|
|
20
|
-
readonly createRoot: (options: RootOptions) => TestRoot;
|
|
21
|
-
readonly createTestPlan: TestPlanFactory;
|
|
22
|
-
readonly execute: Execute;
|
|
23
|
-
readonly nodeVersion: string;
|
|
24
|
-
readonly readExitCode: () => number | string | null | undefined;
|
|
25
|
-
readonly wallClock: WallClock;
|
|
26
|
-
readonly writeExitCode: (exitCode: number) => void;
|
|
27
|
-
};
|
|
28
|
-
export declare function createRunIfMain(dependencies: RunIfMainDependencies): RunIfMain;
|
|
29
|
-
//# sourceMappingURL=run-if-main.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-if-main.d.ts","sourceRoot":"","sources":["../../../../source/engine/run-if-main.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAkB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;IACzC,QAAQ,CAAC,IAAI,CAAC,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,CACpB,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,EAC1B,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,gBAAgB,KACzB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,MAAM,qBAAqB,GAAG;IAChC,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,QAAQ,CAAC;IACxD,QAAQ,CAAC,cAAc,EAAE,eAAe,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAChE,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD,CAAC;AAkDF,wBAAgB,eAAe,CAAC,YAAY,EAAE,qBAAqB,GAAG,SAAS,CAe9E"}
|
package/engine/run-if-main.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { createPlainOutputRenderer } from "./reporter-output.js";
|
|
2
|
-
const failureExitCodes = new Set([undefined, null, 0, '0']);
|
|
3
|
-
function shouldSetFailureExitCode(exitCode) {
|
|
4
|
-
return failureExitCodes.has(exitCode);
|
|
5
|
-
}
|
|
6
|
-
function hasFailure(result) {
|
|
7
|
-
return result.summary.failed > 0 || result.runnerErrors.length > 0;
|
|
8
|
-
}
|
|
9
|
-
function rootMetadata(options) {
|
|
10
|
-
return options?.root?.metadata ?? {};
|
|
11
|
-
}
|
|
12
|
-
function rootName(meta, options) {
|
|
13
|
-
return options?.root?.name ?? meta.url;
|
|
14
|
-
}
|
|
15
|
-
function createRootOptions(meta, testNode, options) {
|
|
16
|
-
return {
|
|
17
|
-
children: [testNode],
|
|
18
|
-
metadata: rootMetadata(options),
|
|
19
|
-
name: rootName(meta, options)
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function createExecuteOptions(options, dependencies) {
|
|
23
|
-
const startedAt = new Date(dependencies.wallClock.currentTimestampInMilliseconds);
|
|
24
|
-
return {
|
|
25
|
-
execution: { mode: 'serial-in-process' },
|
|
26
|
-
outputRenderer: options?.outputRenderer ?? createPlainOutputRenderer(),
|
|
27
|
-
reporters: options?.reporters ?? [],
|
|
28
|
-
runFacts: {
|
|
29
|
-
...options?.runFacts,
|
|
30
|
-
nodeVersion: dependencies.nodeVersion
|
|
31
|
-
},
|
|
32
|
-
startedAt: startedAt.toISOString()
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export function createRunIfMain(dependencies) {
|
|
36
|
-
return async function runIfMain(meta, testNode, options) {
|
|
37
|
-
if (!meta.main) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const result = await dependencies.execute(dependencies.createTestPlan(dependencies.createRoot(createRootOptions(meta, testNode, options))), createExecuteOptions(options, dependencies));
|
|
41
|
-
if (hasFailure(result) && shouldSetFailureExitCode(dependencies.readExitCode())) {
|
|
42
|
-
dependencies.writeExitCode(1);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=run-if-main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-if-main.js","sourceRoot":"","sources":["../../../../source/engine/run-if-main.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAuB,MAAM,sBAAsB,CAAC;AAkCtF,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAqC,CAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,CAAE,CAAC,CAAC;AAElG,SAAS,wBAAwB,CAAC,QAA4C;IAC1E,OAAO,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,U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