@vitest-agent/reporter 6.1.12 → 6.2.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/defaultReporter.js +24 -2
- package/index.d.ts +159 -0
- package/index.js +1 -1
- package/package.json +3 -3
package/defaultReporter.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Doc, Fmt, Render, Status } from "@effected/cli-kit";
|
|
2
|
-
import { RUN_REPORT_FILE_SCHEMA_URL, formatStrayOutputNote } from "@vitest-agent/sdk";
|
|
2
|
+
import { RUN_REPORT_FILE_SCHEMA_URL, formatModuleCacheLines, formatStrayOutputNote } from "@vitest-agent/sdk";
|
|
3
3
|
import { classifyOutcome, classifyRunShape, dispatch, formatSuggestedActionLines, reduceRenderStateAll, synthesizeFromAgentReport } from "@vitest-agent/ui";
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import { resolveFileLink } from "./fileLinks.js";
|
|
@@ -205,6 +205,22 @@ const renderStrayOutputSection = (reports) => {
|
|
|
205
205
|
...lines.length > 0 ? [Doc.lines(lines)] : []
|
|
206
206
|
], summaryRenderContext);
|
|
207
207
|
};
|
|
208
|
+
/** Each report's module cache stat as the entries the render state and the formatter share. */
|
|
209
|
+
const moduleCacheEntriesOf = (reports) => reports.flatMap((report) => report.moduleCache === void 0 ? [] : [{
|
|
210
|
+
...report.project !== void 0 && { project: report.project },
|
|
211
|
+
moduleCache: report.moduleCache
|
|
212
|
+
}]);
|
|
213
|
+
/**
|
|
214
|
+
* How well Vitest's fs module cache served each project's run (issue #741):
|
|
215
|
+
* the same one-line summary the console surfaces print, one line per project
|
|
216
|
+
* that has data (prefixed with its project when several do). `null` when no
|
|
217
|
+
* report carries a stat.
|
|
218
|
+
*/
|
|
219
|
+
const renderModuleCacheSection = (reports) => {
|
|
220
|
+
const lines = formatModuleCacheLines(moduleCacheEntriesOf(reports));
|
|
221
|
+
if (lines.length === 0) return null;
|
|
222
|
+
return Render.markdown([Doc.heading(3, "Module cache"), Doc.lines(lines)], summaryRenderContext);
|
|
223
|
+
};
|
|
208
224
|
/**
|
|
209
225
|
* Per-project pass/fail/timeout/skip/duration table — the unconditional
|
|
210
226
|
* half of the summary body.
|
|
@@ -270,6 +286,7 @@ const renderTotalsSection = (reports) => {
|
|
|
270
286
|
*/
|
|
271
287
|
const buildSummaryMarkdown = (input) => {
|
|
272
288
|
const sections = [
|
|
289
|
+
renderModuleCacheSection(input.reports),
|
|
273
290
|
renderClassificationsSection(input.classifications),
|
|
274
291
|
renderCoverageSection(input.reports),
|
|
275
292
|
renderTrendSection(input.trendSummary),
|
|
@@ -346,7 +363,12 @@ const DefaultVitestAgentReporter = (kit) => {
|
|
|
346
363
|
if (live !== void 0) actionLines = formatSuggestedActionLines(input.suggestedActions ?? []);
|
|
347
364
|
if (shouldRenderForMode(renderKit.config.consoleMode)) {
|
|
348
365
|
const events = input.reports.flatMap((r) => synthesizeFromAgentReport(r, { ...input.suggestedActions !== void 0 ? { suggestedActions: input.suggestedActions } : {} }));
|
|
349
|
-
const
|
|
366
|
+
const folded = reduceRenderStateAll(events);
|
|
367
|
+
const moduleCache = moduleCacheEntriesOf(input.reports);
|
|
368
|
+
const state = moduleCache.length > 0 ? {
|
|
369
|
+
...folded,
|
|
370
|
+
moduleCache
|
|
371
|
+
} : folded;
|
|
350
372
|
const inputs = buildDispatchInputs(state, input, { runCommand: renderKit.config.runCommand ?? null });
|
|
351
373
|
const content = dispatch(inputs, {});
|
|
352
374
|
if (content.length > 0) out.push({
|
package/index.d.ts
CHANGED
|
@@ -81,6 +81,19 @@ declare const RenderState: Schema.Struct<{
|
|
|
81
81
|
readonly diff: Schema.optional<Schema.String>;
|
|
82
82
|
readonly expected: Schema.optional<Schema.String>;
|
|
83
83
|
readonly received: Schema.optional<Schema.String>;
|
|
84
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
85
|
+
readonly name: Schema.String;
|
|
86
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
87
|
+
readonly startTime: Schema.Finite;
|
|
88
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
89
|
+
readonly depth: Schema.Finite;
|
|
90
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
91
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
92
|
+
readonly file: Schema.String;
|
|
93
|
+
readonly line: Schema.Finite;
|
|
94
|
+
readonly column: Schema.Finite;
|
|
95
|
+
}>>;
|
|
96
|
+
}>>>;
|
|
84
97
|
}>>;
|
|
85
98
|
}>>;
|
|
86
99
|
/**
|
|
@@ -167,6 +180,19 @@ declare const RenderState: Schema.Struct<{
|
|
|
167
180
|
readonly diff: Schema.optional<Schema.String>;
|
|
168
181
|
readonly expected: Schema.optional<Schema.String>;
|
|
169
182
|
readonly received: Schema.optional<Schema.String>;
|
|
183
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
184
|
+
readonly name: Schema.String;
|
|
185
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
186
|
+
readonly startTime: Schema.Finite;
|
|
187
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
188
|
+
readonly depth: Schema.Finite;
|
|
189
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
190
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
191
|
+
readonly file: Schema.String;
|
|
192
|
+
readonly line: Schema.Finite;
|
|
193
|
+
readonly column: Schema.Finite;
|
|
194
|
+
}>>;
|
|
195
|
+
}>>>;
|
|
170
196
|
}>>;
|
|
171
197
|
readonly timedOut: Schema.optional<Schema.Boolean>;
|
|
172
198
|
readonly classification: Schema.NullOr<Schema.Literals<readonly ["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
|
|
@@ -199,6 +225,19 @@ declare const RenderState: Schema.Struct<{
|
|
|
199
225
|
readonly diff: Schema.optional<Schema.String>;
|
|
200
226
|
readonly expected: Schema.optional<Schema.String>;
|
|
201
227
|
readonly received: Schema.optional<Schema.String>;
|
|
228
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
229
|
+
readonly name: Schema.String;
|
|
230
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
231
|
+
readonly startTime: Schema.Finite;
|
|
232
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
233
|
+
readonly depth: Schema.Finite;
|
|
234
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
235
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
236
|
+
readonly file: Schema.String;
|
|
237
|
+
readonly line: Schema.Finite;
|
|
238
|
+
readonly column: Schema.Finite;
|
|
239
|
+
}>>;
|
|
240
|
+
}>>>;
|
|
202
241
|
}>>;
|
|
203
242
|
/**
|
|
204
243
|
* What the run wrote straight to the terminal, past Vitest's console
|
|
@@ -235,6 +274,21 @@ declare const RenderState: Schema.Struct<{
|
|
|
235
274
|
readonly files: Schema.Finite;
|
|
236
275
|
}>>;
|
|
237
276
|
}>>;
|
|
277
|
+
/**
|
|
278
|
+
* Module cache effectiveness per project, folded from
|
|
279
|
+
* `RunFinished.moduleCache`. Absent when the run produced no timing data
|
|
280
|
+
* (issue #741).
|
|
281
|
+
*/
|
|
282
|
+
readonly moduleCache: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
283
|
+
readonly project: Schema.optional<Schema.String>;
|
|
284
|
+
readonly moduleCache: Schema.Struct<{
|
|
285
|
+
readonly enabled: Schema.Boolean;
|
|
286
|
+
readonly transformMs: Schema.Finite;
|
|
287
|
+
readonly trackedMs: Schema.Finite;
|
|
288
|
+
readonly share: Schema.Finite;
|
|
289
|
+
readonly modulesWritten: Schema.optional<Schema.Finite>;
|
|
290
|
+
}>;
|
|
291
|
+
}>>>;
|
|
238
292
|
}>;
|
|
239
293
|
/** @public */
|
|
240
294
|
type RenderState = typeof RenderState.Type;
|
|
@@ -429,6 +483,19 @@ declare const AgentReport: Schema.Struct<{
|
|
|
429
483
|
readonly diff: Schema.optional<Schema.String>;
|
|
430
484
|
readonly expected: Schema.optional<Schema.String>;
|
|
431
485
|
readonly received: Schema.optional<Schema.String>;
|
|
486
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
487
|
+
readonly name: Schema.String;
|
|
488
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
489
|
+
readonly startTime: Schema.Finite;
|
|
490
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
491
|
+
readonly depth: Schema.Finite;
|
|
492
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
493
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
494
|
+
readonly file: Schema.String;
|
|
495
|
+
readonly line: Schema.Finite;
|
|
496
|
+
readonly column: Schema.Finite;
|
|
497
|
+
}>>;
|
|
498
|
+
}>>>;
|
|
432
499
|
}>>>;
|
|
433
500
|
readonly tests: Schema.$Array<Schema.Struct<{
|
|
434
501
|
readonly name: Schema.String;
|
|
@@ -443,6 +510,19 @@ declare const AgentReport: Schema.Struct<{
|
|
|
443
510
|
readonly diff: Schema.optional<Schema.String>;
|
|
444
511
|
readonly expected: Schema.optional<Schema.String>;
|
|
445
512
|
readonly received: Schema.optional<Schema.String>;
|
|
513
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
514
|
+
readonly name: Schema.String;
|
|
515
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
516
|
+
readonly startTime: Schema.Finite;
|
|
517
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
518
|
+
readonly depth: Schema.Finite;
|
|
519
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
520
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
521
|
+
readonly file: Schema.String;
|
|
522
|
+
readonly line: Schema.Finite;
|
|
523
|
+
readonly column: Schema.Finite;
|
|
524
|
+
}>>;
|
|
525
|
+
}>>>;
|
|
446
526
|
}>>>;
|
|
447
527
|
readonly classification: Schema.optional<Schema.Literals<readonly ["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
|
|
448
528
|
}>>;
|
|
@@ -453,6 +533,19 @@ declare const AgentReport: Schema.Struct<{
|
|
|
453
533
|
readonly diff: Schema.optional<Schema.String>;
|
|
454
534
|
readonly expected: Schema.optional<Schema.String>;
|
|
455
535
|
readonly received: Schema.optional<Schema.String>;
|
|
536
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
537
|
+
readonly name: Schema.String;
|
|
538
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
539
|
+
readonly startTime: Schema.Finite;
|
|
540
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
541
|
+
readonly depth: Schema.Finite;
|
|
542
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
543
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
544
|
+
readonly file: Schema.String;
|
|
545
|
+
readonly line: Schema.Finite;
|
|
546
|
+
readonly column: Schema.Finite;
|
|
547
|
+
}>>;
|
|
548
|
+
}>>>;
|
|
456
549
|
}>>;
|
|
457
550
|
readonly failedFiles: Schema.$Array<Schema.String>;
|
|
458
551
|
readonly coverage: Schema.optional<Schema.Struct<{
|
|
@@ -593,6 +686,17 @@ declare const AgentReport: Schema.Struct<{
|
|
|
593
686
|
readonly text: Schema.String;
|
|
594
687
|
}>>;
|
|
595
688
|
}>>;
|
|
689
|
+
/**
|
|
690
|
+
* How well Vitest's fs module cache served this project's run (issue
|
|
691
|
+
* #741). Omitted when the run produced no timing data.
|
|
692
|
+
*/
|
|
693
|
+
readonly moduleCache: Schema.optional<Schema.Struct<{
|
|
694
|
+
readonly enabled: Schema.Boolean;
|
|
695
|
+
readonly transformMs: Schema.Finite;
|
|
696
|
+
readonly trackedMs: Schema.Finite;
|
|
697
|
+
readonly share: Schema.Finite;
|
|
698
|
+
readonly modulesWritten: Schema.optional<Schema.Finite>;
|
|
699
|
+
}>>;
|
|
596
700
|
}>;
|
|
597
701
|
/** @public */
|
|
598
702
|
type AgentReport = typeof AgentReport.Type;
|
|
@@ -748,6 +852,19 @@ declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunStarted",
|
|
|
748
852
|
readonly diff: Schema.optional<Schema.String>;
|
|
749
853
|
readonly expected: Schema.optional<Schema.String>;
|
|
750
854
|
readonly received: Schema.optional<Schema.String>;
|
|
855
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
856
|
+
readonly name: Schema.String;
|
|
857
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
858
|
+
readonly startTime: Schema.Finite;
|
|
859
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
860
|
+
readonly depth: Schema.Finite;
|
|
861
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
862
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
863
|
+
readonly file: Schema.String;
|
|
864
|
+
readonly line: Schema.Finite;
|
|
865
|
+
readonly column: Schema.Finite;
|
|
866
|
+
}>>;
|
|
867
|
+
}>>>;
|
|
751
868
|
}>>;
|
|
752
869
|
readonly timedOut: Schema.optional<Schema.Boolean>;
|
|
753
870
|
}>, Schema.TaggedStruct<"ModuleFinished", {
|
|
@@ -790,6 +907,19 @@ declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunStarted",
|
|
|
790
907
|
readonly diff: Schema.optional<Schema.String>;
|
|
791
908
|
readonly expected: Schema.optional<Schema.String>;
|
|
792
909
|
readonly received: Schema.optional<Schema.String>;
|
|
910
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
911
|
+
readonly name: Schema.String;
|
|
912
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
913
|
+
readonly startTime: Schema.Finite;
|
|
914
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
915
|
+
readonly depth: Schema.Finite;
|
|
916
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
917
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
918
|
+
readonly file: Schema.String;
|
|
919
|
+
readonly line: Schema.Finite;
|
|
920
|
+
readonly column: Schema.Finite;
|
|
921
|
+
}>>;
|
|
922
|
+
}>>>;
|
|
793
923
|
}>>;
|
|
794
924
|
}>, Schema.TaggedStruct<"ConsoleLog", {
|
|
795
925
|
readonly modulePath: Schema.optional<Schema.String>;
|
|
@@ -922,6 +1052,19 @@ declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunStarted",
|
|
|
922
1052
|
readonly diff: Schema.optional<Schema.String>;
|
|
923
1053
|
readonly expected: Schema.optional<Schema.String>;
|
|
924
1054
|
readonly received: Schema.optional<Schema.String>;
|
|
1055
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
1056
|
+
readonly name: Schema.String;
|
|
1057
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
1058
|
+
readonly startTime: Schema.Finite;
|
|
1059
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
1060
|
+
readonly depth: Schema.Finite;
|
|
1061
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
1062
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
1063
|
+
readonly file: Schema.String;
|
|
1064
|
+
readonly line: Schema.Finite;
|
|
1065
|
+
readonly column: Schema.Finite;
|
|
1066
|
+
}>>;
|
|
1067
|
+
}>>>;
|
|
925
1068
|
}>>>;
|
|
926
1069
|
/**
|
|
927
1070
|
* What the run wrote straight to the terminal, past Vitest's console
|
|
@@ -958,6 +1101,22 @@ declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunStarted",
|
|
|
958
1101
|
readonly files: Schema.Finite;
|
|
959
1102
|
}>>;
|
|
960
1103
|
}>>;
|
|
1104
|
+
/**
|
|
1105
|
+
* How well Vitest's fs module cache served each project's run
|
|
1106
|
+
* (`AgentReport.moduleCache`), one entry per project that has data.
|
|
1107
|
+
* Optional: absent when no project produced timing data, and in older
|
|
1108
|
+
* replay data (issue #741).
|
|
1109
|
+
*/
|
|
1110
|
+
readonly moduleCache: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
1111
|
+
readonly project: Schema.optional<Schema.String>;
|
|
1112
|
+
readonly moduleCache: Schema.Struct<{
|
|
1113
|
+
readonly enabled: Schema.Boolean;
|
|
1114
|
+
readonly transformMs: Schema.Finite;
|
|
1115
|
+
readonly trackedMs: Schema.Finite;
|
|
1116
|
+
readonly share: Schema.Finite;
|
|
1117
|
+
readonly modulesWritten: Schema.optional<Schema.Finite>;
|
|
1118
|
+
}>;
|
|
1119
|
+
}>>>;
|
|
961
1120
|
}>]>;
|
|
962
1121
|
/** @public */
|
|
963
1122
|
type RunEvent = typeof RunEvent.Type;
|
package/index.js
CHANGED
|
@@ -8,6 +8,6 @@ import { DefaultVitestAgentReporter, buildDispatchInputs, renderAgentStringForRe
|
|
|
8
8
|
*
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
|
-
const CURRENT_REPORTER_VERSION = "6.
|
|
11
|
+
const CURRENT_REPORTER_VERSION = "6.2.0";
|
|
12
12
|
|
|
13
13
|
export { CURRENT_REPORTER_VERSION, DefaultVitestAgentReporter, buildDispatchInputs, renderAgentStringForReport, renderHumanStringForReport };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest-agent/reporter",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Named VitestAgentReporterFactory implementations for the vitest-agent ecosystem.",
|
|
6
6
|
"keywords": [
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@effect/platform-node": "4.1.5",
|
|
43
|
-
"@vitest-agent/sdk": "9.
|
|
44
|
-
"@vitest-agent/ui": "6.0
|
|
43
|
+
"@vitest-agent/sdk": "9.2.0",
|
|
44
|
+
"@vitest-agent/ui": "6.1.0",
|
|
45
45
|
"effect": "4.1.5",
|
|
46
46
|
"ink": "^8.0.0",
|
|
47
47
|
"react": "^19.3.1"
|