@vitest-agent/sdk 7.1.0 → 8.0.0
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/errors/ProjectIdentityError.js +25 -1
- package/index.d.ts +561 -434
- package/index.js +4 -5
- package/package.json +1 -1
- package/schemas/5.0/run.json +18 -222
- package/schemas/AgentReport.js +12 -12
- package/schemas/Common.js +22 -1
- package/schemas/ConsoleLeaks.js +6 -5
- package/schemas/Coverage.js +6 -5
- package/schemas/RenderState.js +8 -1
- package/schemas/RunEvent.js +8 -1
- package/schemas/StrayOutput.js +5 -4
- package/schemas/Thresholds.js +5 -4
- package/utils/console-leaks.js +27 -1
- package/version.js +1 -1
- package/utils/hyperlink.js +0 -10
package/schemas/Thresholds.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FiniteNumber } from "./Common.js";
|
|
1
2
|
import { Effect, Schema } from "effect";
|
|
2
3
|
|
|
3
4
|
// src/schemas/Thresholds.ts
|
|
@@ -6,10 +7,10 @@ import { Effect, Schema } from "effect";
|
|
|
6
7
|
* @public
|
|
7
8
|
*/
|
|
8
9
|
const MetricThresholds = Schema.Struct({
|
|
9
|
-
lines: Schema.optional(
|
|
10
|
-
functions: Schema.optional(
|
|
11
|
-
branches: Schema.optional(
|
|
12
|
-
statements: Schema.optional(
|
|
10
|
+
lines: Schema.optional(FiniteNumber),
|
|
11
|
+
functions: Schema.optional(FiniteNumber),
|
|
12
|
+
branches: Schema.optional(FiniteNumber),
|
|
13
|
+
statements: Schema.optional(FiniteNumber)
|
|
13
14
|
}).annotate({ identifier: "MetricThresholds" });
|
|
14
15
|
/**
|
|
15
16
|
* A `perFile` setting. Vitest 5 allows either a plain boolean or a
|
package/utils/console-leaks.js
CHANGED
|
@@ -99,5 +99,31 @@ function collectConsoleLeakEntries(files) {
|
|
|
99
99
|
}
|
|
100
100
|
return entries;
|
|
101
101
|
}
|
|
102
|
+
const MAX_NOTE_FILES = 3;
|
|
103
|
+
/**
|
|
104
|
+
* The note a renderer prints for a run's console leaks: one line naming the
|
|
105
|
+
* write count, the file count and the fix, then up to three files with
|
|
106
|
+
* their stream split and sample, how many files it left out, and the output
|
|
107
|
+
* from failing tests that the leak count excludes. Empty when the run has no
|
|
108
|
+
* leak from a passing test (output from failing tests alone is not a leak).
|
|
109
|
+
* @public
|
|
110
|
+
*/
|
|
111
|
+
const formatConsoleLeaksNote = (leaks) => {
|
|
112
|
+
if (leaks.total === 0) return [];
|
|
113
|
+
const files = leaks.byFile.length;
|
|
114
|
+
const lines = [`Console leaks: passing tests wrote ${leaks.total} console ${leaks.total === 1 ? "line" : "lines"} in ${files} ${files === 1 ? "file" : "files"}; Vitest captured them, so they are noise an agent never sees. Remove the logging or route it through a logger the tests silence.`];
|
|
115
|
+
const shown = leaks.byFile.slice(0, MAX_NOTE_FILES);
|
|
116
|
+
for (const file of shown) {
|
|
117
|
+
const streams = [file.stdout > 0 ? `${file.stdout} stdout` : "", file.stderr > 0 ? `${file.stderr} stderr` : ""].filter((part) => part.length > 0).join(", ");
|
|
118
|
+
const sample = file.sample !== void 0 ? `: ${file.sample}` : "";
|
|
119
|
+
lines.push(` ${file.file} (${streams})${sample}`);
|
|
120
|
+
}
|
|
121
|
+
const more = leaks.byFile.length - shown.length;
|
|
122
|
+
if (more > 0) lines.push(` (+${more} more ${more === 1 ? "file" : "files"}${leaks.truncated === true ? ", list truncated" : ""})`);
|
|
123
|
+
else if (leaks.truncated === true) lines.push(" (file list truncated)");
|
|
124
|
+
const failing = leaks.fromFailingTests;
|
|
125
|
+
if (failing !== void 0 && failing.total > 0) lines.push(` (${failing.total} more ${failing.total === 1 ? "line" : "lines"} from failing tests in ${failing.files} ${failing.files === 1 ? "file" : "files"}, not counted as leaks)`);
|
|
126
|
+
return lines;
|
|
127
|
+
};
|
|
102
128
|
|
|
103
|
-
export { buildConsoleLeaks, collectConsoleLeakEntries };
|
|
129
|
+
export { buildConsoleLeaks, collectConsoleLeakEntries, formatConsoleLeaksNote };
|
package/version.js
CHANGED
package/utils/hyperlink.js
DELETED