@overkill-dev/run 0.0.4 → 0.0.6
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-evaluation.js +6 -0
- package/assertion-protocol/assertion-evaluation.js.map +1 -0
- package/assertion-protocol/assertion-node.js +33 -0
- package/assertion-protocol/assertion-node.js.map +1 -0
- package/assertion-protocol/assertion-reference.js +49 -0
- package/assertion-protocol/assertion-reference.js.map +1 -0
- package/assertion-protocol/assertions/boolean.js +12 -0
- package/assertion-protocol/assertions/boolean.js.map +1 -0
- package/assertion-protocol/assertions/collection.js +21 -0
- package/assertion-protocol/assertions/collection.js.map +1 -0
- package/assertion-protocol/assertions/dispatch.js +47 -0
- package/assertion-protocol/assertions/dispatch.js.map +1 -0
- package/assertion-protocol/assertions/equality.js +24 -0
- package/assertion-protocol/assertions/equality.js.map +1 -0
- package/assertion-protocol/assertions/fail.js +8 -0
- package/assertion-protocol/assertions/fail.js.map +1 -0
- package/assertion-protocol/assertions/numeric.js +43 -0
- package/assertion-protocol/assertions/numeric.js.map +1 -0
- package/assertion-protocol/assertions/partial.js +17 -0
- package/assertion-protocol/assertions/partial.js.map +1 -0
- package/assertion-protocol/assertions/presence.js +20 -0
- package/assertion-protocol/assertions/presence.js.map +1 -0
- package/assertion-protocol/assertions/string.js +33 -0
- package/assertion-protocol/assertions/string.js.map +1 -0
- package/assertion-protocol/assertions/type-shape.js +43 -0
- package/assertion-protocol/assertions/type-shape.js.map +1 -0
- package/assertion-protocol/collection-count.js +42 -0
- package/assertion-protocol/collection-count.js.map +1 -0
- package/assertion-protocol/evaluation.js +170 -0
- package/assertion-protocol/evaluation.js.map +1 -0
- package/assertion-protocol/partial-matching.js +13 -0
- package/assertion-protocol/partial-matching.js.map +1 -0
- package/assertion-protocol/source-location.js +76 -0
- package/assertion-protocol/source-location.js.map +1 -0
- package/assertion-protocol/thrown-error-record.js +17 -0
- package/assertion-protocol/thrown-error-record.js.map +1 -0
- package/assertion-protocol/thrown-matcher.js +201 -0
- package/assertion-protocol/thrown-matcher.js.map +1 -0
- package/compare/comparison-result.js +47 -0
- package/compare/comparison-result.js.map +1 -0
- package/compare/comparison-state.js +20 -0
- package/compare/comparison-state.js.map +1 -0
- package/compare/comparison.js +78 -0
- package/compare/comparison.js.map +1 -0
- package/compare/diff-path.js +37 -0
- package/compare/diff-path.js.map +1 -0
- package/compare/raw-comparison.js +285 -0
- package/compare/raw-comparison.js.map +1 -0
- package/compare/serialized-value-classification.js +99 -0
- package/compare/serialized-value-classification.js.map +1 -0
- package/compare/serialized-value-shape.js +12 -0
- package/compare/serialized-value-shape.js.map +1 -0
- package/compare/serialized-value-state.js +55 -0
- package/compare/serialized-value-state.js.map +1 -0
- package/compare/serialized-value.js +387 -0
- package/compare/serialized-value.js.map +1 -0
- package/compare/structured-diff.js +382 -0
- package/compare/structured-diff.js.map +1 -0
- package/compare/value-classification.js +112 -0
- package/compare/value-classification.js.map +1 -0
- package/diff/binary-diff.js +49 -0
- package/diff/binary-diff.js.map +1 -0
- package/diff/string-diff.js +22 -0
- package/diff/string-diff.js.map +1 -0
- package/engine/assertion-facade.js +361 -0
- package/engine/assertion-facade.js.map +1 -0
- package/engine/case-execution.js +408 -0
- package/engine/case-execution.js.map +1 -0
- package/engine/custom-assertion-recording.js +175 -0
- package/engine/custom-assertion-recording.js.map +1 -0
- package/engine/execution.d.ts +20 -0
- package/engine/execution.d.ts.map +1 -0
- package/engine/execution.js +323 -0
- package/engine/execution.js.map +1 -0
- package/engine/identity.js +5 -0
- package/engine/identity.js.map +1 -0
- package/engine/reporter-event-queue.js +23 -0
- package/engine/reporter-event-queue.js.map +1 -0
- package/engine/reporter.js +177 -0
- package/engine/reporter.js.map +1 -0
- package/engine/require-assertion-facade.js +127 -0
- package/engine/require-assertion-facade.js.map +1 -0
- package/engine/run-result.js +13 -0
- package/engine/run-result.js.map +1 -0
- package/package.json +17 -3
- package/packages/engine/assertion-protocol.entry-point.js +4 -0
- package/packages/engine/assertion-protocol.entry-point.js.map +1 -0
- package/packages/run/command-line.entry-point.d.ts +5 -0
- package/packages/run/command-line.entry-point.d.ts.map +1 -0
- package/packages/run/command-line.entry-point.js +3 -0
- package/packages/run/command-line.entry-point.js.map +1 -0
- package/packages/run/run.entry-point.d.ts +2 -2
- package/packages/run/run.entry-point.d.ts.map +1 -1
- package/packages/run/run.entry-point.js +1 -1
- package/packages/run/run.entry-point.js.map +1 -1
- package/readme.md +16 -2
- package/run/command-line-runner.d.ts +35 -0
- package/run/command-line-runner.d.ts.map +1 -0
- package/run/command-line-runner.js +109 -0
- package/run/command-line-runner.js.map +1 -0
- package/run/run-config.d.ts +24 -0
- package/run/run-config.d.ts.map +1 -0
- package/run/run-config.js +123 -0
- package/run/run-config.js.map +1 -0
- package/run/run.d.ts +86 -36
- package/run/run.d.ts.map +1 -1
- package/run/run.js +177 -8
- package/run/run.js.map +1 -1
- package/sbom.cdx.json +74 -6
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { captureSourceLocation } from "../assertion-protocol/source-location.js";
|
|
2
|
+
import { recordRequireReference } from "./custom-assertion-recording.js";
|
|
3
|
+
function messageFromOptions(options, annotation) {
|
|
4
|
+
return options?.message ?? annotation;
|
|
5
|
+
}
|
|
6
|
+
export function createRecordingRequireFacadeWithLocation(sink, annotation, captureLocation) {
|
|
7
|
+
const methods = {
|
|
8
|
+
annotated(message) {
|
|
9
|
+
return createRecordingRequireFacadeWithLocation(sink, message, captureLocation);
|
|
10
|
+
},
|
|
11
|
+
array(actual, options) {
|
|
12
|
+
sink.recordRequire({
|
|
13
|
+
actual,
|
|
14
|
+
check: 'array',
|
|
15
|
+
location: captureLocation(),
|
|
16
|
+
message: messageFromOptions(options, annotation),
|
|
17
|
+
source: 'require'
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
boolean(actual, options) {
|
|
21
|
+
sink.recordRequire({
|
|
22
|
+
actual,
|
|
23
|
+
check: 'boolean',
|
|
24
|
+
location: captureLocation(),
|
|
25
|
+
message: messageFromOptions(options, annotation),
|
|
26
|
+
source: 'require'
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
defined(actual, options) {
|
|
30
|
+
sink.recordRequire({
|
|
31
|
+
actual,
|
|
32
|
+
check: 'defined',
|
|
33
|
+
location: captureLocation(),
|
|
34
|
+
message: messageFromOptions(options, annotation),
|
|
35
|
+
source: 'require'
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
function(actual, options) {
|
|
39
|
+
sink.recordRequire({
|
|
40
|
+
actual,
|
|
41
|
+
check: 'function',
|
|
42
|
+
location: captureLocation(),
|
|
43
|
+
message: messageFromOptions(options, annotation),
|
|
44
|
+
source: 'require'
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
hasProperty(actual, key, options) {
|
|
48
|
+
sink.recordRequire({
|
|
49
|
+
actual,
|
|
50
|
+
check: 'has-property',
|
|
51
|
+
key,
|
|
52
|
+
location: captureLocation(),
|
|
53
|
+
message: messageFromOptions(options, annotation),
|
|
54
|
+
source: 'require'
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
instanceOf(actual, expected, options) {
|
|
58
|
+
sink.recordRequire({
|
|
59
|
+
actual,
|
|
60
|
+
check: 'instance-of',
|
|
61
|
+
expected,
|
|
62
|
+
location: captureLocation(),
|
|
63
|
+
message: messageFromOptions(options, annotation),
|
|
64
|
+
source: 'require'
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
notNull(actual, options) {
|
|
68
|
+
sink.recordRequire({
|
|
69
|
+
actual,
|
|
70
|
+
check: 'not-null',
|
|
71
|
+
location: captureLocation(),
|
|
72
|
+
message: messageFromOptions(options, annotation),
|
|
73
|
+
source: 'require'
|
|
74
|
+
});
|
|
75
|
+
},
|
|
76
|
+
null(actual, options) {
|
|
77
|
+
sink.recordRequire({
|
|
78
|
+
actual,
|
|
79
|
+
check: 'null',
|
|
80
|
+
location: captureLocation(),
|
|
81
|
+
message: messageFromOptions(options, annotation),
|
|
82
|
+
source: 'require'
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
number(actual, options) {
|
|
86
|
+
sink.recordRequire({
|
|
87
|
+
actual,
|
|
88
|
+
check: 'number',
|
|
89
|
+
location: captureLocation(),
|
|
90
|
+
message: messageFromOptions(options, annotation),
|
|
91
|
+
source: 'require'
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
object(actual, options) {
|
|
95
|
+
sink.recordRequire({
|
|
96
|
+
actual,
|
|
97
|
+
check: 'object',
|
|
98
|
+
location: captureLocation(),
|
|
99
|
+
message: messageFromOptions(options, annotation),
|
|
100
|
+
source: 'require'
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
string(actual, options) {
|
|
104
|
+
sink.recordRequire({
|
|
105
|
+
actual,
|
|
106
|
+
check: 'string',
|
|
107
|
+
location: captureLocation(),
|
|
108
|
+
message: messageFromOptions(options, annotation),
|
|
109
|
+
source: 'require'
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
function callRequireReference(reference, ...parameters) {
|
|
114
|
+
recordRequireReference({
|
|
115
|
+
annotation,
|
|
116
|
+
location: captureLocation(),
|
|
117
|
+
parameters,
|
|
118
|
+
reference,
|
|
119
|
+
sink
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return Object.assign(callRequireReference, methods);
|
|
123
|
+
}
|
|
124
|
+
export function createRecordingRequireFacade(sink, annotation) {
|
|
125
|
+
return createRecordingRequireFacadeWithLocation(sink, annotation, captureSourceLocation);
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=require-assertion-facade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-assertion-facade.js","sourceRoot":"","sources":["../../../../source/engine/require-assertion-facade.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EACH,sBAAsB,EAEzB,MA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EAAE,eAAe,EAAE;gBAC3B,OAAO,EAAE,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC;gBAChD,MAAM,EAAE,SAAS;aACpB,CAAC,CAAC;QACP,CAAC;QAED,MAAM,CAAC,MAAM,EAAE,OAAO;YAClB,IAAI,CAAC,aAAa,CAAC;gBACf,MAAM;gBACN,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,eAAe,EAAE;gBAC3B,OAAO,EAAE,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC;gBAChD,MAAM,EAAE,SAAS;aACpB,CAAC,CAAC;QACP,CAAC;QAED,MAAM,CAAC,MAAM,EAAE,OAAO;YAClB,IAAI,CAAC,aAAa,CAAC;gBACf,MAAM;gBACN,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,eAAe,EAAE;gBAC3B,OAAO,EAAE,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC;gBAChD,MAAM,EAAE,SAAS;aACpB,CAAC,CAAC;QACP,CAAC;KACJ,CAAC;IAOF,SAAS,oBAAoB,CAAC,SAAkB,EAAE,GAAG,UAA8B;QAC/E,sBAAsB,CAAC;YACnB,UAAU;YACV,QAAQ,EAAE,eAAe,EAAE;YAC3B,UAAU;YACV,SAAS;YACT,IAAI;SACP,CAAC,CAAC;IACP,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,4BAA4B,CACxC,IAA0B,EAC1B,UAAyB;IAEzB,OAAO,wCAAwC,CAAC,IAAI,EAAE,UAAU,EAAE,qBAAqB,CAAC,CAAC;AAC7F,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function invalidDeepAssertionOperandFailure(actual) {
|
|
2
|
+
return {
|
|
3
|
+
actual,
|
|
4
|
+
code: 'invalid-deep-assertion-operand',
|
|
5
|
+
expected: 'non-primitive deep assertion operand',
|
|
6
|
+
kind: 'test-contract',
|
|
7
|
+
summary: 'Deep assertions require non-primitive operands.'
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export function verdictFromOutcome(outcome) {
|
|
11
|
+
return outcome.kind;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=run-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-result.js","sourceRoot":"","sources":["../../../../source/engine/run-result.ts"],"names":[],"mappings":"AA6DA,MAAM,UAAU,kCAAkC,CAAC,MAAmC;IAClF,OAAO;QACH,MAAM;QACN,IAAI,EAAE,gCAAgC;QACtC,QAAQ,EAAE,sCAAsC;QAChD,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,iDAAiD;KAC7D,CAAC;AACN,CAAC;AAmED,MAAM,UAAU,kBAAkB,CAAC,OAAoB;IACnD,OAAO,OAAO,CAAC,IAAI,CAAC;AACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
"url": "https://github.com/enormora/overkill/issues"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@enormora/wall-clock": "0.0.3"
|
|
7
|
+
"@enormora/wall-clock": "0.0.3",
|
|
8
|
+
"@overkill-dev/reporter-line": "0.0.6",
|
|
9
|
+
"@schema-hub/zod-error-formatter": "0.0.15",
|
|
10
|
+
"diff": "9.0.0",
|
|
11
|
+
"zod": "4.4.3"
|
|
8
12
|
},
|
|
9
13
|
"description": "Overkill run resolution and orchestration.",
|
|
10
14
|
"engines": {
|
|
@@ -14,6 +18,10 @@
|
|
|
14
18
|
".": {
|
|
15
19
|
"import": "./packages/run/run.entry-point.js",
|
|
16
20
|
"types": "./packages/run/run.entry-point.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./packages/run/command-line.entry-point.js": {
|
|
23
|
+
"import": "./packages/run/command-line.entry-point.js",
|
|
24
|
+
"types": "./packages/run/command-line.entry-point.d.ts"
|
|
17
25
|
}
|
|
18
26
|
},
|
|
19
27
|
"homepage": "https://github.com/enormora/overkill#readme",
|
|
@@ -28,7 +36,13 @@
|
|
|
28
36
|
"type": "git",
|
|
29
37
|
"url": "git+https://github.com/enormora/overkill.git"
|
|
30
38
|
},
|
|
31
|
-
"sideEffects":
|
|
39
|
+
"sideEffects": [
|
|
40
|
+
"./assertion-protocol/assertion-reference.js",
|
|
41
|
+
"./engine/execution.js",
|
|
42
|
+
"./run/command-line-runner.js",
|
|
43
|
+
"./run/run-config.js",
|
|
44
|
+
"./run/run.js"
|
|
45
|
+
],
|
|
32
46
|
"type": "module",
|
|
33
|
-
"version": "0.0.
|
|
47
|
+
"version": "0.0.6"
|
|
34
48
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createCompositeAssertionGroup, createCompositeAssertionReferenceRecord, createNarrowingCompositeAssertionReferenceRecord, getAssertionReferenceRecord, getCompositeAssertionReferenceRecord, getNarrowingAssertionReferenceRecord, isAssertionReference, isCompositeAssertionGroup, isNarrowingAssertionReference } from "../../assertion-protocol/assertion-reference.js";
|
|
2
|
+
export { thrownMatcherChildren } from "../../assertion-protocol/thrown-matcher.js";
|
|
3
|
+
export { createThrownErrorRecord } from "../../assertion-protocol/thrown-error-record.js";
|
|
4
|
+
//# sourceMappingURL=assertion-protocol.entry-point.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertion-protocol.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/engine/assertion-protocol.entry-point.ts"],"names":[],"mappings":"AAiBA,OAAO,EACH,6BAA6B,EAC7B,uCAAuC,EACvC,gDAAgD,EAChD,2BAA2B,EAC3B,oCAAoC,EACpC,oCAAoC,EACpC,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAChC,MAAM,iDAAiD,CAAC;AA+BzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAEnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { commandLineExitCodes, commandLineRunner } from '../../run/command-line-runner.ts';
|
|
2
|
+
export type { CommandLineExitCode, CommandLineRunner, CommandLineRunnerResult, CommandLineRunTestsRequest } from '../../run/command-line-runner.ts';
|
|
3
|
+
export { defineConfig, loadRunConfig, RunConfigError } from '../../run/run-config.ts';
|
|
4
|
+
export type { LoadedRunConfig, RunConfigLoadRequest, RunProjectConfig } from '../../run/run-config.ts';
|
|
5
|
+
//# sourceMappingURL=command-line.entry-point.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-line.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/run/command-line.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EACpB,iBAAiB,EACpB,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EACR,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,0BAA0B,EAC7B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACH,YAAY,EACZ,aAAa,EACb,cAAc,EACjB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACR,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EACnB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-line.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/run/command-line.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EACpB,iBAAiB,EACpB,MAAM,kCAAkC,CAAC;AAO1C,OAAO,EACH,YAAY,EACZ,aAAa,EACb,cAAc,EACjB,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export type { ResolvedRun, RunDebugRequest, RunExecutionRequest, RunFacts,
|
|
1
|
+
export { orchestrator, RunResolutionError } from '../../run/run.ts';
|
|
2
|
+
export type { ResolvedRun, RunCaseFacts, RunCommand, RunConfig, RunDebugRequest, RunEnvironmentFacts, RunExecutionRequest, RunFacts, RunExecutionFacts, RunLoaderConfig, RunOrchestrator, RunReproducibilityFacts, RunRequest, RunResolutionErrorCode, RunSeed, RunSelection, RunShard, SerializedValue } from '../../run/run.ts';
|
|
3
3
|
//# sourceMappingURL=run.entry-point.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/run/run.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"run.entry-point.d.ts","sourceRoot":"","sources":["../../../../../source/packages/run/run.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACpE,YAAY,EACR,WAAW,EACX,YAAY,EACZ,UAAU,EACV,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,uBAAuB,EACvB,UAAU,EACV,sBAAsB,EACtB,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,eAAe,EAClB,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { orchestrator, RunResolutionError } from "../../run/run.js";
|
|
2
2
|
//# sourceMappingURL=run.entry-point.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/run/run.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"run.entry-point.js","sourceRoot":"","sources":["../../../../../source/packages/run/run.entry-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/readme.md
CHANGED
|
@@ -4,8 +4,22 @@ Run orchestration package for turning caller intent into resolved Overkill runs.
|
|
|
4
4
|
|
|
5
5
|
Top-level API:
|
|
6
6
|
|
|
7
|
+
- `RunCommand`
|
|
7
8
|
- `RunRequest`
|
|
8
9
|
- `RunFacts`
|
|
9
10
|
- `ResolvedRun`
|
|
10
|
-
- `
|
|
11
|
-
- `run(
|
|
11
|
+
- `orchestrator.resolve(command)`
|
|
12
|
+
- `orchestrator.run(command)`
|
|
13
|
+
|
|
14
|
+
Command-line business logic is exposed through `@overkill-dev/run/command-line`:
|
|
15
|
+
|
|
16
|
+
- `commandLineRunner.runTests(request)`
|
|
17
|
+
- `defineConfig(config)`
|
|
18
|
+
- `loadRunConfig({ cwd, configPath })`
|
|
19
|
+
|
|
20
|
+
The current runner accepts an explicit `TestPlan` through `RunCommand`. File
|
|
21
|
+
discovery, filtering, sharding, seeded ordering, resources, records, replay,
|
|
22
|
+
argv parsing, and command-selected lazy loading are separate runner milestones.
|
|
23
|
+
The command-line runner loads native Node config files, selects the default line
|
|
24
|
+
reporter when project config omits reporters, returns fallback diagnostics for
|
|
25
|
+
the binary wrapper to write, and maps run outcomes to stable exit codes.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Reporter } from '../engine/reporter.ts';
|
|
2
|
+
import type { RunResult } from '../engine/run-result.ts';
|
|
3
|
+
import type { TestPlan } from '../engine/test-plan.ts';
|
|
4
|
+
import { type RunOrchestrator, type RunRequest } from './run.ts';
|
|
5
|
+
import { type LoadedRunConfig, type RunConfigLoadRequest } from './run-config.ts';
|
|
6
|
+
export declare const commandLineExitCodes: Readonly<{
|
|
7
|
+
argumentOrConfig: 3;
|
|
8
|
+
internalCrash: 70;
|
|
9
|
+
noTestsCollected: 4;
|
|
10
|
+
pass: 0;
|
|
11
|
+
resourceExhaustion: 5;
|
|
12
|
+
runnerError: 2;
|
|
13
|
+
testFailure: 1;
|
|
14
|
+
}>;
|
|
15
|
+
export type CommandLineExitCode = (typeof commandLineExitCodes)[keyof typeof commandLineExitCodes];
|
|
16
|
+
export type CommandLineRunTestsRequest = RunConfigLoadRequest & {
|
|
17
|
+
readonly request: RunRequest;
|
|
18
|
+
readonly testPlan: TestPlan;
|
|
19
|
+
};
|
|
20
|
+
export type CommandLineRunnerResult = {
|
|
21
|
+
readonly exitCode: CommandLineExitCode;
|
|
22
|
+
readonly fallbackDiagnostics: readonly string[];
|
|
23
|
+
readonly runResult: RunResult | null;
|
|
24
|
+
};
|
|
25
|
+
export type CommandLineRunner = {
|
|
26
|
+
readonly runTests: (request: CommandLineRunTestsRequest) => Promise<CommandLineRunnerResult>;
|
|
27
|
+
};
|
|
28
|
+
export type CommandLineRunnerDependencies = {
|
|
29
|
+
readonly createDefaultReporter: () => Reporter;
|
|
30
|
+
readonly loadRunConfig: (request: RunConfigLoadRequest) => Promise<LoadedRunConfig>;
|
|
31
|
+
readonly orchestrator: RunOrchestrator;
|
|
32
|
+
};
|
|
33
|
+
export declare function createCommandLineRunner(dependencies: CommandLineRunnerDependencies): CommandLineRunner;
|
|
34
|
+
export declare const commandLineRunner: CommandLineRunner;
|
|
35
|
+
//# sourceMappingURL=command-line-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-line-runner.d.ts","sourceRoot":"","sources":["../../../../source/run/command-line-runner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAmB,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAKH,KAAK,eAAe,EACpB,KAAK,UAAU,EAClB,MAAM,UAAU,CAAC;AAClB,OAAO,EAGH,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAC5B,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,oBAAoB;;;;;;;;EAQ/B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;AAEnG,MAAM,MAAM,0BAA0B,GAAG,oBAAoB,GAAG;IAC5D,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;IACvC,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;IAChD,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,0BAA0B,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAChG,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IACxC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,QAAQ,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACpF,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;CAC1C,CAAC;AA4GF,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,6BAA6B,GAAG,iBAAiB,CAWtG;AAED,eAAO,MAAM,iBAAiB,EAAE,iBAI9B,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { createLineReporter } from '@overkill-dev/reporter-line';
|
|
2
|
+
import { orchestrator, RunResolutionError } from "./run.js";
|
|
3
|
+
import { loadRunConfig, RunConfigError } from "./run-config.js";
|
|
4
|
+
export const commandLineExitCodes = Object.freeze({
|
|
5
|
+
argumentOrConfig: 3,
|
|
6
|
+
internalCrash: 70,
|
|
7
|
+
noTestsCollected: 4,
|
|
8
|
+
pass: 0,
|
|
9
|
+
resourceExhaustion: 5,
|
|
10
|
+
runnerError: 2,
|
|
11
|
+
testFailure: 1
|
|
12
|
+
});
|
|
13
|
+
function hasTerminalSink(sink) {
|
|
14
|
+
return sink.kind === 'stdout' || sink.kind === 'stderr';
|
|
15
|
+
}
|
|
16
|
+
function hasTerminalReporter(reporters) {
|
|
17
|
+
return reporters.some(function reporterClaimsTerminal(reporter) {
|
|
18
|
+
return reporter.sinks.some(hasTerminalSink);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function formatRunnerError(error) {
|
|
22
|
+
return `Overkill runner error: ${error.message}`;
|
|
23
|
+
}
|
|
24
|
+
function formatError(error) {
|
|
25
|
+
if (error instanceof Error) {
|
|
26
|
+
return error.message;
|
|
27
|
+
}
|
|
28
|
+
return String(error);
|
|
29
|
+
}
|
|
30
|
+
function fallbackDiagnostics(result, reporters) {
|
|
31
|
+
const reporterErrors = result.runnerErrors.filter(function isReporterError(error) {
|
|
32
|
+
return error.subtype === 'reporter';
|
|
33
|
+
});
|
|
34
|
+
const unreportedErrors = hasTerminalReporter(reporters) ? reporterErrors : result.runnerErrors;
|
|
35
|
+
return unreportedErrors.map(formatRunnerError);
|
|
36
|
+
}
|
|
37
|
+
function exitCodeFromRunResult(result) {
|
|
38
|
+
if (result.runnerErrors.length > 0) {
|
|
39
|
+
return commandLineExitCodes.runnerError;
|
|
40
|
+
}
|
|
41
|
+
if (result.summary.planned === 0) {
|
|
42
|
+
return commandLineExitCodes.noTestsCollected;
|
|
43
|
+
}
|
|
44
|
+
if (result.summary.failed > 0) {
|
|
45
|
+
return commandLineExitCodes.testFailure;
|
|
46
|
+
}
|
|
47
|
+
return commandLineExitCodes.pass;
|
|
48
|
+
}
|
|
49
|
+
function commandLineConfig(loadedConfig, dependencies) {
|
|
50
|
+
return {
|
|
51
|
+
loader: loadedConfig.loader,
|
|
52
|
+
reporters: loadedConfig.reporters ?? [dependencies.createDefaultReporter()],
|
|
53
|
+
runtimeStateDir: loadedConfig.runtimeStateDir
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function commandFromRequest(request, loadedConfig, dependencies) {
|
|
57
|
+
return {
|
|
58
|
+
config: commandLineConfig(loadedConfig, dependencies),
|
|
59
|
+
request: request.request,
|
|
60
|
+
testPlan: request.testPlan
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function errorResult(exitCode, label, error) {
|
|
64
|
+
return {
|
|
65
|
+
exitCode,
|
|
66
|
+
fallbackDiagnostics: [`Overkill ${label}: ${formatError(error)}`],
|
|
67
|
+
runResult: null
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async function runTestsWithLoadedConfig(request, dependencies, loadedConfig) {
|
|
71
|
+
const command = commandFromRequest(request, loadedConfig, dependencies);
|
|
72
|
+
const runResult = await dependencies.orchestrator.run(command);
|
|
73
|
+
return {
|
|
74
|
+
exitCode: exitCodeFromRunResult(runResult),
|
|
75
|
+
fallbackDiagnostics: fallbackDiagnostics(runResult, command.config.reporters),
|
|
76
|
+
runResult
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function commandLineErrorResult(error) {
|
|
80
|
+
if (error instanceof RunConfigError) {
|
|
81
|
+
return errorResult(commandLineExitCodes.argumentOrConfig, 'configuration error', error);
|
|
82
|
+
}
|
|
83
|
+
if (error instanceof RunResolutionError) {
|
|
84
|
+
return errorResult(commandLineExitCodes.argumentOrConfig, 'argument error', error);
|
|
85
|
+
}
|
|
86
|
+
if (error instanceof TypeError && error.message.startsWith('Reporter sink conflict:')) {
|
|
87
|
+
return errorResult(commandLineExitCodes.argumentOrConfig, 'configuration error', error);
|
|
88
|
+
}
|
|
89
|
+
return errorResult(commandLineExitCodes.internalCrash, 'internal error', error);
|
|
90
|
+
}
|
|
91
|
+
export function createCommandLineRunner(dependencies) {
|
|
92
|
+
return {
|
|
93
|
+
async runTests(request) {
|
|
94
|
+
try {
|
|
95
|
+
const loadedConfig = await dependencies.loadRunConfig(request);
|
|
96
|
+
return await runTestsWithLoadedConfig(request, dependencies, loadedConfig);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
return commandLineErrorResult(error);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export const commandLineRunner = createCommandLineRunner({
|
|
105
|
+
createDefaultReporter: createLineReporter,
|
|
106
|
+
loadRunConfig,
|
|
107
|
+
orchestrator
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=command-line-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-line-runner.js","sourceRoot":"","sources":["../../../../source/run/command-line-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAIjE,OAAO,EACH,YAAY,EACZ,kBAAkB,EAKrB,MAAM,UAAU,CAAC;AAClB,OAAO,EACH,aAAa,EACb,cAAc,EAGjB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,gBAAgB,EAAE,CAAC;IACnB,aAAa,EAAE,EAAE;IACjB,gBAAgB,EAAE,CAAC;IACnB,IAAI,EAAE,CAAC;IACP,kBAAkB,EAAE,CAAC;IACrB,WAAW,EAAE,CAAC;IACd,WAAW,EAAE,CAAC;CACjB,CAAC,CAAC;AAyBH,SAAS,eAAe,CAAC,IAAqB;IAC1C,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;AAC5D,CAAC;AAED,SAAS,mBAAmB,CAAC,SAA8B;IACvD,OAAO,SAAS,CAAC,IAAI,CAAC,SAAS,sBAAsB,CAAC,QAAQ;QAC1D,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAkB;IACzC,OAAO,0BAA0B,KAAK,CAAC,OAAO,EAAE,C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AO,CAAC,UAAU,CAAC,yBAAyB,CAAC,EAAE,CAAC;QACpF,OAAO,WAAW,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,WAAW,CAAC,oBAAoB,CAAC,aAAa,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,YAA2C;IAC/E,OAAO;QACH,KAAK,CAAC,QAAQ,CAAC,OAAO;YAClB,IAAI,CAAC;gBACD,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;gBAC/D,OAAO,MAAM,wBAAwB,CAAC,OAAO,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;YAC/E,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACtB,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;YACzC,CAAC;QACL,CAAC;KACJ,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAsB,uBAAuB,CAAC;IACxE,qBAAqB,EAAE,kBAAkB;IACzC,aAAa;IACb,YAAY;CACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { NonEmptyReadonlyArray } from '../assertion-protocol/assertion-node-shape.ts';
|
|
2
|
+
import type { Reporter } from '../engine/reporter.ts';
|
|
3
|
+
import type { RunLoaderConfig } from './run.ts';
|
|
4
|
+
export type RunProjectConfig = {
|
|
5
|
+
readonly loader?: RunLoaderConfig;
|
|
6
|
+
readonly reporters?: NonEmptyReadonlyArray<Reporter>;
|
|
7
|
+
readonly runtimeStateDir?: string;
|
|
8
|
+
};
|
|
9
|
+
export type LoadedRunConfig = {
|
|
10
|
+
readonly configPath: string | null;
|
|
11
|
+
readonly loader: RunLoaderConfig;
|
|
12
|
+
readonly reporters: NonEmptyReadonlyArray<Reporter> | null;
|
|
13
|
+
readonly runtimeStateDir: string;
|
|
14
|
+
};
|
|
15
|
+
export type RunConfigLoadRequest = {
|
|
16
|
+
readonly configPath: string | null;
|
|
17
|
+
readonly cwd: string;
|
|
18
|
+
};
|
|
19
|
+
export declare class RunConfigError extends Error {
|
|
20
|
+
constructor(message: string, options?: Readonly<ErrorOptions>);
|
|
21
|
+
}
|
|
22
|
+
export declare function defineConfig(config: RunProjectConfig): RunProjectConfig;
|
|
23
|
+
export declare function loadRunConfig(request: RunConfigLoadRequest): Promise<LoadedRunConfig>;
|
|
24
|
+
//# sourceMappingURL=run-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-config.d.ts","sourceRoot":"","sources":["../../../../source/run/run-config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAC3F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IACrD,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,qBAAqB,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IAC3D,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,qBAAa,cAAe,SAAQ,KAAK;gBAClB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;CAIvE;AA+BD,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAEvE;AA6FD,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,eAAe,CAAC,CAW3F"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
return path;
|
|
8
|
+
};
|
|
9
|
+
import fs from 'node:fs/promises';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import { pathToFileURL } from 'node:url';
|
|
12
|
+
import { parse } from '@schema-hub/zod-error-formatter';
|
|
13
|
+
import { z } from 'zod/v4';
|
|
14
|
+
const defaultConfigFileNames = ['overkill.config.ts', 'overkill.config.js'];
|
|
15
|
+
export class RunConfigError extends Error {
|
|
16
|
+
constructor(message, options) {
|
|
17
|
+
super(message, options);
|
|
18
|
+
this.name = 'RunConfigError';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const defaultLoader = {
|
|
22
|
+
sourceMaps: false,
|
|
23
|
+
stripMode: 'strip-only'
|
|
24
|
+
};
|
|
25
|
+
const reporterSchema = z.custom(function isReporter(value) {
|
|
26
|
+
return typeof value === 'object' && value !== null &&
|
|
27
|
+
Object.hasOwn(value, 'kind') &&
|
|
28
|
+
Object.hasOwn(value, 'name') &&
|
|
29
|
+
Object.hasOwn(value, 'sinks');
|
|
30
|
+
});
|
|
31
|
+
const loaderSchema = z.strictObject({
|
|
32
|
+
sourceMaps: z.boolean(),
|
|
33
|
+
stripMode: z.union([z.literal('strip-only'), z.literal('transform')])
|
|
34
|
+
});
|
|
35
|
+
const projectConfigSchema = z.strictObject({
|
|
36
|
+
loader: z.optional(loaderSchema),
|
|
37
|
+
reporters: z.optional(z.array(reporterSchema).min(1)),
|
|
38
|
+
runtimeStateDir: z.optional(z.string().min(1))
|
|
39
|
+
});
|
|
40
|
+
export function defineConfig(config) {
|
|
41
|
+
return config;
|
|
42
|
+
}
|
|
43
|
+
async function fileExists(filePath) {
|
|
44
|
+
try {
|
|
45
|
+
await fs.access(filePath);
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function discoverConfigPath(cwd) {
|
|
53
|
+
for (const configFileName of defaultConfigFileNames) {
|
|
54
|
+
const candidate = path.resolve(cwd, configFileName);
|
|
55
|
+
if (await fileExists(candidate)) {
|
|
56
|
+
return candidate;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
async function resolveConfigPath(request) {
|
|
62
|
+
if (request.configPath !== null) {
|
|
63
|
+
return path.resolve(request.cwd, request.configPath);
|
|
64
|
+
}
|
|
65
|
+
return await discoverConfigPath(request.cwd);
|
|
66
|
+
}
|
|
67
|
+
async function importConfigModule(configPath) {
|
|
68
|
+
try {
|
|
69
|
+
return await import(__rewriteRelativeImportExtension(pathToFileURL(configPath).href));
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
throw new RunConfigError(`Failed to load config file "${configPath}".`, { cause: error });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function hasDefaultExport(configModule) {
|
|
76
|
+
return typeof configModule === 'object' && configModule !== null && Object.hasOwn(configModule, 'default');
|
|
77
|
+
}
|
|
78
|
+
function readDefaultExport(configModule, configPath) {
|
|
79
|
+
if (hasDefaultExport(configModule)) {
|
|
80
|
+
return configModule.default;
|
|
81
|
+
}
|
|
82
|
+
throw new RunConfigError(`Config file "${configPath}" must export a default config object.`);
|
|
83
|
+
}
|
|
84
|
+
function normalizeReporters(reporters) {
|
|
85
|
+
if (reporters === undefined) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
const [firstReporter, ...remainingReporters] = reporters;
|
|
89
|
+
if (firstReporter === undefined) {
|
|
90
|
+
throw new RunConfigError('Config reporters must not be empty.');
|
|
91
|
+
}
|
|
92
|
+
return [firstReporter, ...remainingReporters];
|
|
93
|
+
}
|
|
94
|
+
function normalizeConfig(parsedConfig, configPath) {
|
|
95
|
+
return {
|
|
96
|
+
configPath,
|
|
97
|
+
loader: parsedConfig.loader ?? defaultLoader,
|
|
98
|
+
reporters: normalizeReporters(parsedConfig.reporters),
|
|
99
|
+
runtimeStateDir: parsedConfig.runtimeStateDir ?? '.overkill'
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function parseConfig(configValue, configPath) {
|
|
103
|
+
try {
|
|
104
|
+
const parsedConfig = parse(projectConfigSchema, configValue);
|
|
105
|
+
return parsedConfig;
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
if (error instanceof Error) {
|
|
109
|
+
throw new RunConfigError(`Invalid config file "${configPath}": ${error.message}`, { cause: error });
|
|
110
|
+
}
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export async function loadRunConfig(request) {
|
|
115
|
+
const configPath = await resolveConfigPath(request);
|
|
116
|
+
if (configPath === null) {
|
|
117
|
+
return normalizeConfig({}, null);
|
|
118
|
+
}
|
|
119
|
+
const configModule = await importConfigModule(configPath);
|
|
120
|
+
const configValue = readDefaultExport(configModule, configPath);
|
|
121
|
+
return normalizeConfig(parseConfig(configValue, configPath), configPath);
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=run-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-config.js","sourceRoot":"","sources":["../../../../source/run/run-config.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACxD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAK3B,MAAM,sBAAsB,GAAG,CAAE,oBAAoB,EAAE,oBAAoB,CAAE,CAAC;AAoB9E,MAAM,OAAO,cAAe,SAAQ,KAAK;IACrC,YAAmB,OAAe,EAAE,OAAgC;QAChE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IACjC,CAAC;CACJ;AAED,MAAM,aAAa,GAAoB;IACnC,UAAU,EAAE,KAAK;IACjB,SAAS,EAAE,YAAY;CAC1B,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAW,SAAS,UAAU,CAAC,KAAK;IAC/D,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAC9C,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC;QAC5B,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACtC,CAAC,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC;IAChC,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE;IACvB,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAE,CAAC,CAAC,OAAO,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