@feigi/fleet-ctl 3.32.0 → 3.32.1
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/package.json +1 -1
- package/scripts/recipe-prove.mjs +14 -3
package/package.json
CHANGED
package/scripts/recipe-prove.mjs
CHANGED
|
@@ -24,8 +24,12 @@
|
|
|
24
24
|
// - the count proof: `--count-line` is a literal the run's own output
|
|
25
25
|
// must contain (text off the runner's summary line, read off a
|
|
26
26
|
// previous run), carrying `--test-count`, a positive integer no larger
|
|
27
|
-
// than Number.MAX_SAFE_INTEGER, as its one number.
|
|
28
|
-
//
|
|
27
|
+
// than Number.MAX_SAFE_INTEGER, as its one number. Where the literal
|
|
28
|
+
// starts or ends on a digit, the output must have no digit beside it
|
|
29
|
+
// there: `3 passed` is not found in `13 passed`. Only a digit bounds
|
|
30
|
+
// the number — a `,`, `_` or `.` inside one is not a digit, so
|
|
31
|
+
// `234 passed` is found in `1,234 passed`. `tests 0` is a failed proof
|
|
32
|
+
// however honestly the runner reports it.
|
|
29
33
|
// - the mutation proof: the unmutated run must be green; `--mutate` is a
|
|
30
34
|
// shell command that must change a tracked file (the deliberate
|
|
31
35
|
// failing mutation of one test, or of the code one test covers) — run
|
|
@@ -273,7 +277,14 @@ function prove(o, wt, logs) {
|
|
|
273
277
|
if (numbers.length !== 1 || BigInt(numbers[0]) !== BigInt(o.testCount)) {
|
|
274
278
|
throw notProven(`the count line '${o.countLine}' does not carry the test count ${o.testCount} as its one number (it carries ${numbers.length ? numbers.join(", ") : "none"}) — trim it to the number of tests that ran; ${where}`);
|
|
275
279
|
}
|
|
276
|
-
|
|
280
|
+
// The literal's number must be the log's number, not the tail or head of a
|
|
281
|
+
// longer one: where the literal starts or ends on a digit, no digit may
|
|
282
|
+
// stand beside the match there — `3 passed` is not found in `13 passed`.
|
|
283
|
+
// A non-digit edge already bounds the number, so a digit beside it is fine.
|
|
284
|
+
const literal = o.countLine.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
285
|
+
const before = /^[0-9]/.test(o.countLine) ? "(?<![0-9])" : "";
|
|
286
|
+
const after = /[0-9]$/.test(o.countLine) ? "(?![0-9])" : "";
|
|
287
|
+
if (!new RegExp(before + literal + after).test(readFileSync(testLog, "utf8"))) {
|
|
277
288
|
throw notProven(`vacuous: the Test entrypoint's output does not contain the count line '${o.countLine}' — no evidence any test ran; ${where}`);
|
|
278
289
|
}
|
|
279
290
|
proof.testCount = n;
|