@overkill-dev/engine 0.0.1 → 0.0.2
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/LICENSE +21 -0
- package/assertion-protocol/assertion-evaluation.d.ts +13 -0
- package/assertion-protocol/assertion-evaluation.d.ts.map +1 -0
- package/assertion-protocol/assertion-evaluation.js +6 -0
- package/assertion-protocol/assertion-evaluation.js.map +1 -0
- package/assertion-protocol/assertion-node-shape.d.ts +71 -0
- package/assertion-protocol/assertion-node-shape.d.ts.map +1 -0
- package/assertion-protocol/assertion-node.d.ts +97 -0
- package/assertion-protocol/assertion-node.d.ts.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.d.ts +73 -0
- package/assertion-protocol/assertion-reference.d.ts.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.d.ts +11 -0
- package/assertion-protocol/assertions/boolean.d.ts.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.d.ts +22 -0
- package/assertion-protocol/assertions/collection.d.ts.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.d.ts +88 -0
- package/assertion-protocol/assertions/dispatch.d.ts.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.d.ts +17 -0
- package/assertion-protocol/assertions/equality.d.ts.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.d.ts +13 -0
- package/assertion-protocol/assertions/fail.d.ts.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.d.ts +29 -0
- package/assertion-protocol/assertions/numeric.d.ts.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.d.ts +14 -0
- package/assertion-protocol/assertions/partial.d.ts.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.d.ts +17 -0
- package/assertion-protocol/assertions/presence.d.ts.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.d.ts +28 -0
- package/assertion-protocol/assertions/string.d.ts.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.d.ts +42 -0
- package/assertion-protocol/assertions/type-shape.d.ts.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.d.ts +6 -0
- package/assertion-protocol/collection-count.d.ts.map +1 -0
- package/assertion-protocol/collection-count.js +42 -0
- package/assertion-protocol/collection-count.js.map +1 -0
- package/assertion-protocol/evaluation.d.ts +32 -0
- package/assertion-protocol/evaluation.d.ts.map +1 -0
- package/assertion-protocol/evaluation.js +170 -0
- package/assertion-protocol/evaluation.js.map +1 -0
- package/assertion-protocol/partial-matching.d.ts +4 -0
- package/assertion-protocol/partial-matching.d.ts.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.d.ts +6 -0
- package/assertion-protocol/source-location.d.ts.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.d.ts +8 -0
- package/assertion-protocol/thrown-error-record.d.ts.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.d.ts +51 -0
- package/assertion-protocol/thrown-matcher.d.ts.map +1 -0
- package/assertion-protocol/thrown-matcher.js +201 -0
- package/assertion-protocol/thrown-matcher.js.map +1 -0
- package/compare/comparison-result.d.ts +25 -0
- package/compare/comparison-result.d.ts.map +1 -0
- package/compare/comparison-result.js +47 -0
- package/compare/comparison-result.js.map +1 -0
- package/compare/comparison-state.d.ts +7 -0
- package/compare/comparison-state.d.ts.map +1 -0
- package/compare/comparison-state.js +20 -0
- package/compare/comparison-state.js.map +1 -0
- package/compare/comparison.d.ts +12 -0
- package/compare/comparison.d.ts.map +1 -0
- package/compare/comparison.js +78 -0
- package/compare/comparison.js.map +1 -0
- package/compare/diff-path.d.ts +8 -0
- package/compare/diff-path.d.ts.map +1 -0
- package/compare/diff-path.js +37 -0
- package/compare/diff-path.js.map +1 -0
- package/compare/raw-comparison.d.ts +24 -0
- package/compare/raw-comparison.d.ts.map +1 -0
- package/compare/raw-comparison.js +285 -0
- package/compare/raw-comparison.js.map +1 -0
- package/compare/serialized-value-classification.d.ts +12 -0
- package/compare/serialized-value-classification.d.ts.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.d.ts +143 -0
- package/compare/serialized-value-shape.d.ts.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.d.ts +12 -0
- package/compare/serialized-value-state.d.ts.map +1 -0
- package/compare/serialized-value-state.js +55 -0
- package/compare/serialized-value-state.js.map +1 -0
- package/compare/serialized-value.d.ts +11 -0
- package/compare/serialized-value.d.ts.map +1 -0
- package/compare/serialized-value.js +389 -0
- package/compare/serialized-value.js.map +1 -0
- package/compare/structured-diff.d.ts +4 -0
- package/compare/structured-diff.d.ts.map +1 -0
- package/compare/structured-diff.js +382 -0
- package/compare/structured-diff.js.map +1 -0
- package/compare/value-classification.d.ts +26 -0
- package/compare/value-classification.d.ts.map +1 -0
- package/compare/value-classification.js +112 -0
- package/compare/value-classification.js.map +1 -0
- package/diff/binary-diff.d.ts +4 -0
- package/diff/binary-diff.d.ts.map +1 -0
- package/diff/binary-diff.js +49 -0
- package/diff/binary-diff.js.map +1 -0
- package/diff/diff-shape.d.ts +117 -0
- package/diff/diff-shape.d.ts.map +1 -0
- package/diff/string-diff.d.ts +3 -0
- package/diff/string-diff.d.ts.map +1 -0
- package/diff/string-diff.js +22 -0
- package/diff/string-diff.js.map +1 -0
- package/engine/assertion-facade.d.ts +50 -0
- package/engine/assertion-facade.d.ts.map +1 -0
- package/engine/assertion-facade.js +361 -0
- package/engine/assertion-facade.js.map +1 -0
- package/engine/case-execution.d.ts +10 -0
- package/engine/case-execution.d.ts.map +1 -0
- package/engine/case-execution.js +408 -0
- package/engine/case-execution.js.map +1 -0
- package/engine/custom-assertion-recording.d.ts +33 -0
- package/engine/custom-assertion-recording.d.ts.map +1 -0
- package/engine/custom-assertion-recording.js +175 -0
- package/engine/custom-assertion-recording.js.map +1 -0
- package/engine/engine.d.ts +24 -0
- package/engine/engine.d.ts.map +1 -0
- package/engine/engine.js +33 -0
- package/engine/engine.js.map +1 -0
- package/engine/execution.d.ts +16 -0
- package/engine/execution.d.ts.map +1 -0
- package/engine/execution.js +223 -0
- package/engine/execution.js.map +1 -0
- package/engine/identity.d.ts +12 -0
- package/engine/identity.d.ts.map +1 -0
- package/engine/identity.js +20 -0
- package/engine/identity.js.map +1 -0
- package/engine/reporter.d.ts +103 -0
- package/engine/reporter.d.ts.map +1 -0
- package/engine/reporter.js +177 -0
- package/engine/reporter.js.map +1 -0
- package/engine/require-assertion-facade.d.ts +21 -0
- package/engine/require-assertion-facade.d.ts.map +1 -0
- package/engine/require-assertion-facade.js +127 -0
- package/engine/require-assertion-facade.js.map +1 -0
- package/engine/run-if-main.d.ts +20 -0
- package/engine/run-if-main.d.ts.map +1 -0
- package/engine/run-if-main.js +30 -0
- package/engine/run-if-main.js.map +1 -0
- package/engine/run-result.d.ts +110 -0
- package/engine/run-result.d.ts.map +1 -0
- package/engine/run-result.js +13 -0
- package/engine/run-result.js.map +1 -0
- package/engine/test-node.d.ts +88 -0
- package/engine/test-node.d.ts.map +1 -0
- package/engine/test-node.js +103 -0
- package/engine/test-node.js.map +1 -0
- package/engine/test-plan.d.ts +20 -0
- package/engine/test-plan.d.ts.map +1 -0
- package/engine/test-plan.js +115 -0
- package/engine/test-plan.js.map +1 -0
- package/package.json +78 -6
- package/packages/engine/assertion-protocol.entry-point.d.ts +9 -0
- package/packages/engine/assertion-protocol.entry-point.d.ts.map +1 -0
- package/packages/engine/assertion-protocol.entry-point.js +4 -0
- package/packages/engine/assertion-protocol.entry-point.js.map +1 -0
- package/packages/engine/engine.entry-point.d.ts +39 -0
- package/packages/engine/engine.entry-point.d.ts.map +1 -0
- package/packages/engine/engine.entry-point.js +47 -0
- package/packages/engine/engine.entry-point.js.map +1 -0
- package/readme.md +121 -5
- package/sbom.cdx.json +67 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { serializeValue } from "../compare/serialized-value.js";
|
|
2
|
+
import { assertionSummary } from "./assertion-node.js";
|
|
3
|
+
import { assertionEvaluatorByCheck } from "./assertions/dispatch.js";
|
|
4
|
+
import { resolveSourceLocation } from "./source-location.js";
|
|
5
|
+
function primitiveValueType(value) {
|
|
6
|
+
if (value === null) {
|
|
7
|
+
return 'null';
|
|
8
|
+
}
|
|
9
|
+
const valueType = typeof value;
|
|
10
|
+
return valueType === 'object' || valueType === 'function' ? null : valueType;
|
|
11
|
+
}
|
|
12
|
+
function invalidOperand(check, role, value, index) {
|
|
13
|
+
const type = primitiveValueType(value);
|
|
14
|
+
return type === null
|
|
15
|
+
? null
|
|
16
|
+
: {
|
|
17
|
+
check,
|
|
18
|
+
index,
|
|
19
|
+
role,
|
|
20
|
+
type
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function invalidMember(check, role, values) {
|
|
24
|
+
for (const [index, value] of values.entries()) {
|
|
25
|
+
const invalid = invalidOperand(check, role, value, index);
|
|
26
|
+
if (invalid !== null) {
|
|
27
|
+
return invalid;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
function invalidExactDeepAssertionOperand(check, assertion) {
|
|
33
|
+
return invalidOperand(check, 'actual', assertion.actual, null) ??
|
|
34
|
+
invalidOperand(check, 'expected', assertion.expected, null);
|
|
35
|
+
}
|
|
36
|
+
function invalidArrayContainsPartialOperand(check, assertion) {
|
|
37
|
+
const invalidActualMember = Array.isArray(assertion.actual)
|
|
38
|
+
? invalidMember(check, 'actual', assertion.actual)
|
|
39
|
+
: null;
|
|
40
|
+
return invalidOperand(check, 'actual', assertion.actual, null) ??
|
|
41
|
+
invalidActualMember ??
|
|
42
|
+
invalidOperand(check, 'expected', assertion.expected, null);
|
|
43
|
+
}
|
|
44
|
+
function invalidMembersPartialDeepEqualOperand(check, assertion) {
|
|
45
|
+
const invalidActualMember = Array.isArray(assertion.actual)
|
|
46
|
+
? invalidMember(check, 'actual', assertion.actual)
|
|
47
|
+
: null;
|
|
48
|
+
const invalidExpectedMember = Array.isArray(assertion.expected)
|
|
49
|
+
? invalidMember(check, 'expected', assertion.expected)
|
|
50
|
+
: null;
|
|
51
|
+
return invalidOperand(check, 'actual', assertion.actual, null) ??
|
|
52
|
+
invalidOperand(check, 'expected', assertion.expected, null) ??
|
|
53
|
+
invalidActualMember ??
|
|
54
|
+
invalidExpectedMember;
|
|
55
|
+
}
|
|
56
|
+
const deepOperandFinders = {
|
|
57
|
+
'array-contains-partial': invalidArrayContainsPartialOperand,
|
|
58
|
+
'deep-equal': invalidExactDeepAssertionOperand,
|
|
59
|
+
'members-partial-deep-equal': invalidMembersPartialDeepEqualOperand,
|
|
60
|
+
'not-deep-equal': invalidExactDeepAssertionOperand,
|
|
61
|
+
'partial-deep-equal': invalidExactDeepAssertionOperand
|
|
62
|
+
};
|
|
63
|
+
function isDeepAssertionCheck(check) {
|
|
64
|
+
return Object.hasOwn(deepOperandFinders, check);
|
|
65
|
+
}
|
|
66
|
+
function isDeepAssertion(assertion) {
|
|
67
|
+
return isDeepAssertionCheck(assertion.check) && Object.hasOwn(assertion, 'expected');
|
|
68
|
+
}
|
|
69
|
+
export function invalidDeepAssertionOperand(assertion) {
|
|
70
|
+
if (assertion.check === 'composite') {
|
|
71
|
+
for (const child of assertion.children) {
|
|
72
|
+
const invalid = invalidDeepAssertionOperand(child);
|
|
73
|
+
if (invalid !== null) {
|
|
74
|
+
return invalid;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
return isDeepAssertion(assertion)
|
|
80
|
+
? deepOperandFinders[assertion.check](assertion.check, assertion)
|
|
81
|
+
: null;
|
|
82
|
+
}
|
|
83
|
+
function evaluateAssertionNode(check, assertion) {
|
|
84
|
+
return assertionEvaluatorByCheck[check](assertion);
|
|
85
|
+
}
|
|
86
|
+
function assertNonEmptyItems(items, message) {
|
|
87
|
+
if (items.length === 0) {
|
|
88
|
+
throw new TypeError(message);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function evaluateForeignAssertion(assertion, id) {
|
|
92
|
+
if (assertion.result.passed) {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
actual: serializeValue(assertion.label),
|
|
97
|
+
diff: null,
|
|
98
|
+
error: assertion.result.error,
|
|
99
|
+
expected: serializeValue('foreign assertion pass'),
|
|
100
|
+
id,
|
|
101
|
+
kind: 'foreign',
|
|
102
|
+
label: assertion.label,
|
|
103
|
+
location: resolveSourceLocation(assertion.location),
|
|
104
|
+
path: [],
|
|
105
|
+
source: assertion.source,
|
|
106
|
+
summary: assertion.message ?? assertion.summary
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function evaluateLeafAssertion(assertion, id) {
|
|
110
|
+
const evaluation = {
|
|
111
|
+
...evaluateAssertionNode(assertion.check, assertion),
|
|
112
|
+
summary: assertionSummary(assertion)
|
|
113
|
+
};
|
|
114
|
+
if (evaluation.passed) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
actual: evaluation.actual,
|
|
119
|
+
diff: evaluation.diff,
|
|
120
|
+
expected: evaluation.expected,
|
|
121
|
+
id,
|
|
122
|
+
kind: 'leaf',
|
|
123
|
+
location: resolveSourceLocation(assertion.location),
|
|
124
|
+
path: evaluation.path,
|
|
125
|
+
source: assertion.source,
|
|
126
|
+
summary: evaluation.summary
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function evaluateCompositeChild(assertion, id) {
|
|
130
|
+
if (assertion.check === 'foreign') {
|
|
131
|
+
return evaluateForeignAssertion(assertion, id);
|
|
132
|
+
}
|
|
133
|
+
return evaluateLeafAssertion(assertion, id);
|
|
134
|
+
}
|
|
135
|
+
function evaluateCompositeAssertion(assertion, id) {
|
|
136
|
+
const children = assertion.children.flatMap(function evaluateChild(child, index) {
|
|
137
|
+
const failedCheck = evaluateCompositeChild(child, `${id}.${index + 1}`);
|
|
138
|
+
return failedCheck === null ? [] : [failedCheck];
|
|
139
|
+
});
|
|
140
|
+
if (children.length === 0) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
assertNonEmptyItems(children, 'Expected composite assertion failure to contain failed children.');
|
|
144
|
+
return {
|
|
145
|
+
actual: serializeValue(assertion.actual),
|
|
146
|
+
children,
|
|
147
|
+
diff: null,
|
|
148
|
+
expected: serializeValue(assertion.expected),
|
|
149
|
+
id,
|
|
150
|
+
kind: 'composite',
|
|
151
|
+
location: resolveSourceLocation(assertion.location),
|
|
152
|
+
path: [],
|
|
153
|
+
source: assertion.source,
|
|
154
|
+
summary: assertionSummary(assertion)
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
export function evaluateAssertion(assertion, id) {
|
|
158
|
+
const checkId = String(id);
|
|
159
|
+
if (assertion.check === 'composite') {
|
|
160
|
+
return evaluateCompositeAssertion(assertion, checkId);
|
|
161
|
+
}
|
|
162
|
+
if (assertion.check === 'foreign') {
|
|
163
|
+
return evaluateForeignAssertion(assertion, checkId);
|
|
164
|
+
}
|
|
165
|
+
return evaluateLeafAssertion(assertion, checkId);
|
|
166
|
+
}
|
|
167
|
+
export function assertionPasses(assertion) {
|
|
168
|
+
return evaluateAssertion(assertion, 1) === null;
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=evaluation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluation.js","sourceRoot":"","sources":["../../../../source/assertion-protocol/evaluation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EACH,gBAAgB,EAMnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,yBAAyB,EAA6B,MAAM,0BAA0B,CAAC;AAChG,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AA4C7D,SAAS,kBAAkB,CAAC,KAAc;IACtC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;IAE/B,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACjF,CAAC;AAED,SAAS,cAAc,CACnB,KAAyB,EACzB,IAA8B,EAC9B,KAAc,EACd,KAAoB;IAEpB,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAEvC,OAAO,IAAI,KAAK,IAAI;QAChB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC;YACE,KAAK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ElG,OAAO;QACH,MAAM,EAAE,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC;QACxC,QAAQ;QACR,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC;QAC5C,EAAE;QACF,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,qBAAqB,CAAC,SAAS,CAAC,QAAQ,CAAC;QACnD,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC;KACvC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC7B,SAAsD,EACtD,EAAmB;IAEnB,MAAM,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;IAE3B,IAAI,SAAS,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;QAClC,OAAO,0BAA0B,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED,IAAI,SAAS,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,wBAAwB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,OAAO,qBAAqB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,SAAwB;IACpD,OAAO,iBAAiB,CAAC,SAAS,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function isPlainObject(value: unknown): value is Readonly<Record<PropertyKey, unknown>>;
|
|
2
|
+
export declare function ownKeys(value: Readonly<Record<PropertyKey, unknown>>): readonly PropertyKey[];
|
|
3
|
+
export declare function partialDeepEqual(actual: unknown, expected: unknown): boolean;
|
|
4
|
+
//# sourceMappingURL=partial-matching.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial-matching.d.ts","sourceRoot":"","sources":["../../../../source/assertion-protocol/partial-matching.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAQ7F;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,WAAW,EAAE,CAE7F;AAqDD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAgB5E"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { compareDeepValues } from "../compare/comparison.js";
|
|
2
|
+
export function isPlainObject(value) {
|
|
3
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
const prototype = Object.getPrototypeOf(value);
|
|
7
|
+
return prototype === Object.prototype || prototype === null;
|
|
8
|
+
}
|
|
9
|
+
export function ownKeys(value) {
|
|
10
|
+
return Reflect.ownKeys(value);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=partial-matching.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial-matching.js","sourceRoot":"","sources":["../../../../source/assertion-protocol/partial-matching.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B;AAE5D,MAAM,UAAU,aAAa,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACtE,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,SAAS,GAAY,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAExD,OAAO,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC;AAChE;AAEA,MAAM,UAAU,OAAO,CAAC,KAA6C;IACjE,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAClC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ResolvableSourceLocation, SourceLocation, SourceLocationProvider } from './assertion-node-shape.ts';
|
|
2
|
+
export declare const unknownSourceLocation: SourceLocation;
|
|
3
|
+
export declare function sourceLocationFromStack(stack: string): SourceLocation;
|
|
4
|
+
export declare function captureSourceLocation(): SourceLocationProvider;
|
|
5
|
+
export declare function resolveSourceLocation(location: ResolvableSourceLocation): SourceLocation;
|
|
6
|
+
//# sourceMappingURL=source-location.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-location.d.ts","sourceRoot":"","sources":["../../../../source/assertion-protocol/source-location.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,wBAAwB,EACxB,cAAc,EACd,sBAAsB,EACzB,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,qBAAqB,EAAE,cAInC,CAAC;AA6DF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAIrE;AAED,wBAAgB,qBAAqB,IAAI,sBAAsB,CAW9D;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,wBAAwB,GAAG,cAAc,CAUxF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
export const unknownSourceLocation = {
|
|
3
|
+
column: null,
|
|
4
|
+
file: '',
|
|
5
|
+
line: null
|
|
6
|
+
};
|
|
7
|
+
const stackFramePattern = /^\s*at (?:.+? \()?(?<file>.+):(?<line>\d+):(?<column>\d+)\)?$/u;
|
|
8
|
+
const internalModulePatterns = [
|
|
9
|
+
/\/assertion-protocol\/source-location\.[cm]?[jt]s$/u,
|
|
10
|
+
/\/assertion-protocol\/assertion-reference\.[cm]?[jt]s$/u,
|
|
11
|
+
/\/engine\/assertion-facade\.[cm]?[jt]s$/u,
|
|
12
|
+
/\/engine\/custom-assertion-recording\.[cm]?[jt]s$/u,
|
|
13
|
+
/\/engine\/require-assertion-facade\.[cm]?[jt]s$/u
|
|
14
|
+
];
|
|
15
|
+
function normalizeStackFile(file) {
|
|
16
|
+
if (!file.startsWith('file:')) {
|
|
17
|
+
return file;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
return fileURLToPath(file);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return file;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function stackFileIsInternal(file) {
|
|
27
|
+
if (file.length === 0 || file.startsWith('node:')) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
const normalizedFile = file.replaceAll('\\', '/');
|
|
31
|
+
return internalModulePatterns.some(function patternMatches(pattern) {
|
|
32
|
+
return pattern.test(normalizedFile);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function sourceLocationFromStackGroups(groups) {
|
|
36
|
+
const file = normalizeStackFile(groups.file);
|
|
37
|
+
return stackFileIsInternal(file)
|
|
38
|
+
? null
|
|
39
|
+
: { column: Number(groups.column), file, line: Number(groups.line) };
|
|
40
|
+
}
|
|
41
|
+
function isStackFrameGroups(groups) {
|
|
42
|
+
return groups.file !== undefined && groups.line !== undefined && groups.column !== undefined;
|
|
43
|
+
}
|
|
44
|
+
function sourceLocationFromStackLine(line) {
|
|
45
|
+
const groups = stackFramePattern.exec(line)?.groups;
|
|
46
|
+
return groups !== undefined && isStackFrameGroups(groups)
|
|
47
|
+
? sourceLocationFromStackGroups(groups)
|
|
48
|
+
: null;
|
|
49
|
+
}
|
|
50
|
+
export function sourceLocationFromStack(stack) {
|
|
51
|
+
return stack.split('\n').reduce(function findLocation(found, line) {
|
|
52
|
+
return found ?? sourceLocationFromStackLine(line);
|
|
53
|
+
}, null) ?? unknownSourceLocation;
|
|
54
|
+
}
|
|
55
|
+
export function captureSourceLocation() {
|
|
56
|
+
const stackCarrier = new Error('Overkill source location');
|
|
57
|
+
let location = null;
|
|
58
|
+
return function capturedSourceLocation() {
|
|
59
|
+
if (location === null) {
|
|
60
|
+
location = sourceLocationFromStack(stackCarrier.stack ?? '');
|
|
61
|
+
}
|
|
62
|
+
return location;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function resolveSourceLocation(location) {
|
|
66
|
+
if (typeof location !== 'function') {
|
|
67
|
+
return location;
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
return location();
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return unknownSourceLocation;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=source-location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-location.js","sourceRoot":"","sources":["../../../../source/assertion-protocol/source-location.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAOzC,MAAM,CAAC,MAAM,qBAAqB,GAAmB;IACjD,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,IAAI;CACb,CAAC;AAEF,MAAM,iBAAiB,GAAG,gEAAgE,CAAC;AAE3F,MAAM,sBAAsB,GAAG;IAC3B,qDAAqD;IACrD,yDAAyD;IACzD,0CAA0C;IAC1C,oDAAoD;IACpD,kDAAkD;CAC5C,CAAC;AAEX,SAAS,kBAAkB,CAAC,IAAY;IACpC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,CAAC;QACD,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,IAAI,CAAC;IAChB,CAAC;AACL,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAY;IAC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Y,CAAC,KAAK,EAAE,IAAI;QACpF,OAAO,KAAK,IAAI,2BAA2B,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC,EAAE,IAAI,CAAC,IAAI,qBAAqB,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,qBAAqB;IACjC,MAAM,YAAY,GAAG,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC3D,IAAI,QAAQ,GAA0B,IAAI,CAAC;IAE3C,OAAO,SAAS,sBAAsB;QAClC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACpB,QAAQ,GAAG,uBAAuB,CAAC,YAAY,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QACjE,CAAC;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAkC;IACpE,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,IAAI,CAAC;QACD,OAAO,QAAQ,EAAE,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,qBAAqB,CAAC;IACjC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ThrownErrorRecord = {
|
|
2
|
+
readonly message: string;
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly stack: string | null;
|
|
5
|
+
readonly thrown: unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare function createThrownErrorRecord(thrown: unknown): ThrownErrorRecord;
|
|
8
|
+
//# sourceMappingURL=thrown-error-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thrown-error-record.d.ts","sourceRoot":"","sources":["../../../../source/assertion-protocol/thrown-error-record.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,iBAAiB,CAgB1E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function createThrownErrorRecord(thrown) {
|
|
2
|
+
if (thrown instanceof Error) {
|
|
3
|
+
return {
|
|
4
|
+
message: thrown.message,
|
|
5
|
+
name: thrown.name,
|
|
6
|
+
stack: thrown.stack ?? null,
|
|
7
|
+
thrown
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
message: 'Test body threw a non-error value.',
|
|
12
|
+
name: typeof thrown,
|
|
13
|
+
stack: null,
|
|
14
|
+
thrown
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=thrown-error-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thrown-error-record.js","sourceRoot":"","sources":["../../../../source/assertion-protocol/thrown-error-record.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,uBAAuB,CAAC,MAAe;IACnD,IAAI,MAAM,YAAY,KAAK,EAAE,CAAC;QAC1B,OAAO;YACH,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,IAAI;YAC3B,MAAM;SACT,CAAC;IACN,CAAC;IAED,OAAO;QACH,OAAO,EAAE,oCAAoC;QAC7C,IAAI,EAAE,OAAO,MAAM;QACnB,KAAK,EAAE,IAAI;QACX,MAAM;KACT,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { CompositeAssertionChildNode, CompositeAssertionNode } from './assertion-node.ts';
|
|
2
|
+
import type { AssertionSource, InstanceConstructor, NonEmptyReadonlyArray, ResolvableSourceLocation } from './assertion-node-shape.ts';
|
|
3
|
+
type OptionalFields<Shape, RequiredKey extends keyof Shape> = {
|
|
4
|
+
readonly [ShapeKey in keyof Shape as ShapeKey extends RequiredKey ? never : ShapeKey]?: Shape[ShapeKey];
|
|
5
|
+
};
|
|
6
|
+
type RequiredField<Shape, RequiredKey extends keyof Shape> = {
|
|
7
|
+
readonly [ShapeKey in RequiredKey]-?: Shape[ShapeKey];
|
|
8
|
+
};
|
|
9
|
+
type RequireAtLeastOne<Shape, Key extends keyof Shape = keyof Shape> = {
|
|
10
|
+
readonly [RequiredKey in Key]: OptionalFields<Shape, RequiredKey> & RequiredField<Shape, RequiredKey>;
|
|
11
|
+
}[Key];
|
|
12
|
+
type ErrorConstructor = InstanceConstructor & (abstract new (...args: never[]) => Error);
|
|
13
|
+
type ErrorMatcherFields = {
|
|
14
|
+
readonly cause: ThrownMatcher;
|
|
15
|
+
readonly code: string;
|
|
16
|
+
readonly message: RegExp | string;
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly type: ErrorConstructor;
|
|
19
|
+
};
|
|
20
|
+
export type ExactThrownMatcher = {
|
|
21
|
+
readonly cause?: never;
|
|
22
|
+
readonly code?: never;
|
|
23
|
+
readonly exact: unknown;
|
|
24
|
+
readonly message?: never;
|
|
25
|
+
readonly name?: never;
|
|
26
|
+
readonly type?: never;
|
|
27
|
+
};
|
|
28
|
+
export type ErrorMatcher = RequireAtLeastOne<ErrorMatcherFields> & {
|
|
29
|
+
readonly exact?: never;
|
|
30
|
+
};
|
|
31
|
+
export type ThrownMatcher = ErrorMatcher | ExactThrownMatcher;
|
|
32
|
+
type NonPromise<Body extends () => unknown> = ReturnType<Body> extends PromiseLike<unknown> ? never : Body;
|
|
33
|
+
export type SynchronousCallback<Body extends () => unknown> = [ReturnType<Body>] extends [never] ? Body : NonPromise<Body>;
|
|
34
|
+
type ThrownAssertionKind = 'rejects' | 'throws';
|
|
35
|
+
type ObservationStatus = 'rejected' | 'resolved' | 'returned' | 'threw';
|
|
36
|
+
export type ThrownAssertionObservation = {
|
|
37
|
+
readonly status: ObservationStatus;
|
|
38
|
+
readonly value: unknown;
|
|
39
|
+
};
|
|
40
|
+
type ThrownAssertionInput<Source extends AssertionSource> = {
|
|
41
|
+
readonly kind: ThrownAssertionKind;
|
|
42
|
+
readonly location: ResolvableSourceLocation;
|
|
43
|
+
readonly matcher: ThrownMatcher;
|
|
44
|
+
readonly message: string | null;
|
|
45
|
+
readonly observation: ThrownAssertionObservation;
|
|
46
|
+
readonly source: Source;
|
|
47
|
+
};
|
|
48
|
+
export declare function thrownMatcherChildren<Source extends AssertionSource>(input: ThrownAssertionInput<Source>): NonEmptyReadonlyArray<CompositeAssertionChildNode<Source>>;
|
|
49
|
+
export declare function createThrownMatcherAssertion<Source extends AssertionSource>(input: ThrownAssertionInput<Source>): CompositeAssertionNode<Source>;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=thrown-matcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thrown-matcher.d.ts","sourceRoot":"","sources":["../../../../source/assertion-protocol/thrown-matcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,2BAA2B,EAC3B,sBAAsB,EACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EACR,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EAC3B,MAAM,2BAA2B,CAAC;AAEnC,KAAK,cAAc,CAAC,KAAK,EAAE,WAAW,SAAS,MAAM,KAAK,IAAI;IAC1D,QAAQ,EAAE,QAAQ,IAAI,MAAM,KAAK,IAAI,QAAQ,SAAS,WAAW,GAAG,KAAK,GAAG,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;CAC1G,CAAC;AAEF,KAAK,aAAa,CAAC,KAAK,EAAE,WAAW,SAAS,MAAM,KAAK,IAAI;IACzD,QAAQ,EAAE,QAAQ,IAAI,WAAW,CAAC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
|
2
|
+
if (items.length === 0) {
|
|
3
|
+
throw new TypeError(message);
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
function isExactThrownMatcher(matcher) {
|
|
7
|
+
return Object.hasOwn(matcher, 'exact');
|
|
8
|
+
}
|
|
9
|
+
function expectedAction(kind) {
|
|
10
|
+
return kind === 'throws' ? 'throw' : 'reject';
|
|
11
|
+
}
|
|
12
|
+
function missingThrownValueChild(input) {
|
|
13
|
+
return {
|
|
14
|
+
actual: false,
|
|
15
|
+
check: 'true',
|
|
16
|
+
location: input.location,
|
|
17
|
+
message: `Expected function to ${expectedAction(input.kind)}.`,
|
|
18
|
+
source: input.source
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function expectedMatcherChild(input) {
|
|
22
|
+
if (input.check === 'equal') {
|
|
23
|
+
return {
|
|
24
|
+
actual: input.actual,
|
|
25
|
+
check: input.check,
|
|
26
|
+
expected: input.expected,
|
|
27
|
+
location: input.location,
|
|
28
|
+
message: input.message,
|
|
29
|
+
source: input.source
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
actual: input.actual,
|
|
34
|
+
check: input.check,
|
|
35
|
+
expected: input.expected,
|
|
36
|
+
location: input.location,
|
|
37
|
+
message: input.message,
|
|
38
|
+
source: input.source
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function matchMatcherChild(input) {
|
|
42
|
+
return {
|
|
43
|
+
actual: input.actual,
|
|
44
|
+
check: input.check,
|
|
45
|
+
location: input.location,
|
|
46
|
+
message: input.message,
|
|
47
|
+
pattern: input.pattern,
|
|
48
|
+
source: input.source
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function errorCode(error) {
|
|
52
|
+
return Reflect.get(error, 'code');
|
|
53
|
+
}
|
|
54
|
+
function matcherHas(matcher, key) {
|
|
55
|
+
return Object.hasOwn(matcher, key);
|
|
56
|
+
}
|
|
57
|
+
function errorInstanceChild(input, value, label) {
|
|
58
|
+
return expectedMatcherChild({
|
|
59
|
+
actual: value,
|
|
60
|
+
check: 'instance-of',
|
|
61
|
+
expected: Error,
|
|
62
|
+
location: input.location,
|
|
63
|
+
message: `Expected ${label} to be an Error.`,
|
|
64
|
+
source: input.source
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function typeMatcherChildren(input, matcher, value, label) {
|
|
68
|
+
return matcherHas(matcher, 'type')
|
|
69
|
+
? [
|
|
70
|
+
expectedMatcherChild({
|
|
71
|
+
actual: value,
|
|
72
|
+
check: 'instance-of',
|
|
73
|
+
expected: matcher.type,
|
|
74
|
+
location: input.location,
|
|
75
|
+
message: `Expected ${label} to be an instance of the constructor.`,
|
|
76
|
+
source: input.source
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
: [];
|
|
80
|
+
}
|
|
81
|
+
function messageMatcherChildren(input, matcher, value, label) {
|
|
82
|
+
if (matcherHas(matcher, 'message')) {
|
|
83
|
+
return matcher.message instanceof RegExp
|
|
84
|
+
? [
|
|
85
|
+
matchMatcherChild({
|
|
86
|
+
actual: value.message,
|
|
87
|
+
check: 'match',
|
|
88
|
+
location: input.location,
|
|
89
|
+
message: `Expected ${label} message to match the pattern.`,
|
|
90
|
+
pattern: matcher.message,
|
|
91
|
+
source: input.source
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
: [
|
|
95
|
+
expectedMatcherChild({
|
|
96
|
+
actual: value.message,
|
|
97
|
+
check: 'equal',
|
|
98
|
+
expected: matcher.message,
|
|
99
|
+
location: input.location,
|
|
100
|
+
message: `Expected ${label} message to equal the string.`,
|
|
101
|
+
source: input.source
|
|
102
|
+
})
|
|
103
|
+
];
|
|
104
|
+
}
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
function codeMatcherChildren(input, matcher, value, label) {
|
|
108
|
+
return matcherHas(matcher, 'code')
|
|
109
|
+
? [
|
|
110
|
+
expectedMatcherChild({
|
|
111
|
+
actual: errorCode(value),
|
|
112
|
+
check: 'equal',
|
|
113
|
+
expected: matcher.code,
|
|
114
|
+
location: input.location,
|
|
115
|
+
message: `Expected ${label} code to equal the string.`,
|
|
116
|
+
source: input.source
|
|
117
|
+
})
|
|
118
|
+
]
|
|
119
|
+
: [];
|
|
120
|
+
}
|
|
121
|
+
function nameMatcherChildren(input, matcher, value, label) {
|
|
122
|
+
return matcherHas(matcher, 'name')
|
|
123
|
+
? [
|
|
124
|
+
expectedMatcherChild({
|
|
125
|
+
actual: value.name,
|
|
126
|
+
check: 'equal',
|
|
127
|
+
expected: matcher.name,
|
|
128
|
+
location: input.location,
|
|
129
|
+
message: `Expected ${label} name to equal the string.`,
|
|
130
|
+
source: input.source
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
: [];
|
|
134
|
+
}
|
|
135
|
+
function causeMatcherChildren(input) {
|
|
136
|
+
return matcherHas(input.matcher, 'cause')
|
|
137
|
+
? input.childrenForMatcher(input.assertion, input.matcher.cause, input.value.cause, `${input.label} cause`)
|
|
138
|
+
: [];
|
|
139
|
+
}
|
|
140
|
+
function structuredErrorChildren(input) {
|
|
141
|
+
if (!(input.value instanceof Error)) {
|
|
142
|
+
return [errorInstanceChild(input.assertion, input.value, input.label)];
|
|
143
|
+
}
|
|
144
|
+
const errorInput = {
|
|
145
|
+
...input,
|
|
146
|
+
value: input.value
|
|
147
|
+
};
|
|
148
|
+
return [
|
|
149
|
+
errorInstanceChild(input.assertion, input.value, input.label),
|
|
150
|
+
...typeMatcherChildren(input.assertion, input.matcher, input.value, input.label),
|
|
151
|
+
...messageMatcherChildren(input.assertion, input.matcher, input.value, input.label),
|
|
152
|
+
...codeMatcherChildren(input.assertion, input.matcher, input.value, input.label),
|
|
153
|
+
...nameMatcherChildren(input.assertion, input.matcher, input.value, input.label),
|
|
154
|
+
...causeMatcherChildren(errorInput)
|
|
155
|
+
];
|
|
156
|
+
}
|
|
157
|
+
const matcherChildren = function createMatcherChildren(input, matcher, value, label) {
|
|
158
|
+
return isExactThrownMatcher(matcher)
|
|
159
|
+
? [
|
|
160
|
+
expectedMatcherChild({
|
|
161
|
+
actual: value,
|
|
162
|
+
check: 'equal',
|
|
163
|
+
expected: matcher.exact,
|
|
164
|
+
location: input.location,
|
|
165
|
+
message: `Expected ${label} to equal the exact matcher.`,
|
|
166
|
+
source: input.source
|
|
167
|
+
})
|
|
168
|
+
]
|
|
169
|
+
: structuredErrorChildren({
|
|
170
|
+
assertion: input,
|
|
171
|
+
childrenForMatcher: createMatcherChildren,
|
|
172
|
+
label,
|
|
173
|
+
matcher,
|
|
174
|
+
value
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
export function thrownMatcherChildren(input) {
|
|
178
|
+
const expectedStatus = input.kind === 'throws' ? 'threw' : 'rejected';
|
|
179
|
+
const children = input.observation.status === expectedStatus
|
|
180
|
+
? matcherChildren(input, input.matcher, input.observation.value, 'thrown value')
|
|
181
|
+
: [missingThrownValueChild(input)];
|
|
182
|
+
assertNonEmptyItems(children, 'Expected thrown matcher assertion to create children.');
|
|
183
|
+
return children;
|
|
184
|
+
}
|
|
185
|
+
function thrownMatcherSummary(kind) {
|
|
186
|
+
return `Expected function to ${expectedAction(kind)} matching value.`;
|
|
187
|
+
}
|
|
188
|
+
export function createThrownMatcherAssertion(input) {
|
|
189
|
+
return {
|
|
190
|
+
actual: input.observation,
|
|
191
|
+
check: 'composite',
|
|
192
|
+
children: thrownMatcherChildren(input),
|
|
193
|
+
expected: input.matcher,
|
|
194
|
+
location: input.location,
|
|
195
|
+
message: input.message,
|
|
196
|
+
name: input.kind,
|
|
197
|
+
source: input.source,
|
|
198
|
+
summary: thrownMatcherSummary(input.kind)
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=thrown-matcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thrown-matcher.js","sourceRoot":"","sources":["../../../../source/assertion-protocol/thrown-matcher.ts"],"names":[],"mappings":"AAkHA,SAAS,mBAAmB,C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ACxD,CAAC,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC;QAChF,CAAC,CAAC,CAAE,uBAAuB,CAAC,KAAK,CAAC,CAAE,CAAC;IAEzC,mBAAmB,CAAC,QAAQ,EAAE,uDAAuD,CAAC,CAAC;IAEvF,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAyB;IACnD,OAAO,wBAAwB,cAAc,CAAC,IAAI,CAAC,kBAAkB,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,4BAA4B,CACxC,KAAmC;IAEnC,OAAO;QACH,MAAM,EAAE,KAAK,CAAC,WAAW;QACzB,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC;QACtC,QAAQ,EAAE,KAAK,CAAC,OAAO;QACvB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC;KAC5C,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Diff, DiffPathSegment } from '../diff/diff-shape.ts';
|
|
2
|
+
import { type SerializedValue } from './serialized-value.ts';
|
|
3
|
+
export type ComparisonResult = {
|
|
4
|
+
readonly actual: SerializedValue;
|
|
5
|
+
readonly diff: Diff | null;
|
|
6
|
+
readonly expected: SerializedValue;
|
|
7
|
+
readonly passed: boolean;
|
|
8
|
+
readonly path: readonly DiffPathSegment[];
|
|
9
|
+
};
|
|
10
|
+
type ComparisonResultInput = {
|
|
11
|
+
readonly actual: unknown;
|
|
12
|
+
readonly diff: Diff | null;
|
|
13
|
+
readonly expected: unknown;
|
|
14
|
+
readonly passed: boolean;
|
|
15
|
+
readonly path: readonly DiffPathSegment[];
|
|
16
|
+
};
|
|
17
|
+
export declare const emptyPath: readonly DiffPathSegment[];
|
|
18
|
+
export declare function firstDiffPath(diff: Diff | null): readonly DiffPathSegment[];
|
|
19
|
+
export declare function comparisonResult(input: ComparisonResultInput): ComparisonResult;
|
|
20
|
+
export declare function passedResult(actual: unknown, expected: unknown): ComparisonResult;
|
|
21
|
+
export declare function failedResult(actual: unknown, expected: unknown, diff: Diff | null): ComparisonResult;
|
|
22
|
+
export declare function serializedValueDiff(actual: unknown, expected: unknown): Diff;
|
|
23
|
+
export declare function valueMismatch(actual: unknown, expected: unknown): ComparisonResult;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=comparison-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comparison-result.d.ts","sourceRoot":"","sources":["../../../../source/compare/comparison-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAER,IAAI,EACJ,eAAe,EAIlB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,eAAe,EAAkB,MAAM,uBAAuB,CAAC;AAE7E,MAAM,MAAM,gBAAgB,GAAG;IAC3B,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,eAAe,EAAE,CAAC;CAC7C,CAAC;AAEF,KAAK,qBAAqB,GAAG;IACzB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC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