@vitest-agent/ui 6.0.7 → 6.1.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/counts.js +1 -1
- package/dispatcher/cells/single-file-pass.js +1 -1
- package/dispatcher/cells/single-file-threshold.js +1 -1
- package/dispatcher/cells/single-project-pass.js +1 -1
- package/dispatcher/dispatch.js +16 -2
- package/dispatcher/helpers.js +3 -1
- package/index.d.ts +214 -0
- package/index.js +2 -2
- package/ink/CountColumns.js +1 -1
- package/ink/CoverageBlock.js +1 -1
- package/ink/FailureSection.js +10 -2
- package/ink/FailuresSection.js +2 -2
- package/ink/FileLink.js +1 -1
- package/ink/ModuleHeader.js +1 -1
- package/ink/ProjectRow.js +3 -3
- package/ink/StatusIcon.js +1 -1
- package/ink/StreamApp.js +10 -4
- package/ink/TagColumns.js +1 -1
- package/ink/TestRow.js +1 -1
- package/ink/TrendLine.js +1 -1
- package/ink/dispatch-ink.js +3 -2
- package/ink/ink-helpers.js +1 -1
- package/ink.d.ts +93 -0
- package/package.json +3 -3
- package/reducer.js +2 -1
- package/render-agent.js +8 -2
- package/synthesize.js +9 -4
- package/trace-steps.js +22 -0
package/counts.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Fmt } from "@effected/cli-kit";
|
|
1
2
|
import { buildFooter } from "../footer.js";
|
|
2
3
|
import { formatDisplayDuration } from "../../format-duration.js";
|
|
3
4
|
import { soleModulePath } from "../helpers.js";
|
|
4
|
-
import { Fmt } from "@effected/cli-kit";
|
|
5
5
|
|
|
6
6
|
// src/dispatcher/cells/single-file-pass.ts
|
|
7
7
|
const renderAgent = (inputs) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Fmt } from "@effected/cli-kit";
|
|
1
2
|
import { buildFooter } from "../footer.js";
|
|
2
3
|
import { formatDisplayDuration } from "../../format-duration.js";
|
|
3
4
|
import { formatCoverageSummaryLines, soleModulePath } from "../helpers.js";
|
|
4
|
-
import { Fmt } from "@effected/cli-kit";
|
|
5
5
|
|
|
6
6
|
// src/dispatcher/cells/single-file-threshold.ts
|
|
7
7
|
const renderAgent = (inputs) => {
|
package/dispatcher/dispatch.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatConsoleLeaksNote, formatModuleCacheLines, formatScopedCoverageNote, formatStrayOutputNote } from "@vitest-agent/sdk";
|
|
1
2
|
import { renderSingleFileFail } from "./cells/single-file-fail.js";
|
|
2
3
|
import { renderSingleFilePass } from "./cells/single-file-pass.js";
|
|
3
4
|
import { renderSingleFileThreshold } from "./cells/single-file-threshold.js";
|
|
@@ -11,7 +12,6 @@ import { renderWorkspaceFail } from "./cells/workspace-fail.js";
|
|
|
11
12
|
import { renderWorkspacePass } from "./cells/workspace-pass.js";
|
|
12
13
|
import { renderWorkspaceThreshold } from "./cells/workspace-threshold.js";
|
|
13
14
|
import { formatSuggestedActionLines } from "./helpers.js";
|
|
14
|
-
import { formatConsoleLeaksNote, formatScopedCoverageNote, formatStrayOutputNote } from "@vitest-agent/sdk";
|
|
15
15
|
|
|
16
16
|
// src/dispatcher/dispatch.ts
|
|
17
17
|
/**
|
|
@@ -57,6 +57,7 @@ const dispatch = (inputs, opts) => {
|
|
|
57
57
|
const note = scopedCoverageNoteFor(inputs);
|
|
58
58
|
const withNote = note !== null ? `${body}\n${note}` : body;
|
|
59
59
|
const trailers = [
|
|
60
|
+
moduleCacheNoteFor(inputs),
|
|
60
61
|
suggestedActionsNoteFor(inputs),
|
|
61
62
|
strayOutputNoteFor(inputs),
|
|
62
63
|
consoleLeaksNoteFor(inputs)
|
|
@@ -77,6 +78,19 @@ const suggestedActionsNoteFor = (inputs) => {
|
|
|
77
78
|
return lines.length === 0 ? null : lines.join("\n");
|
|
78
79
|
};
|
|
79
80
|
/**
|
|
81
|
+
* The module-cache lines for the run (issue #741), or `null` when no project
|
|
82
|
+
* produced timing data. `dispatch` and `dispatchInk` append them after the
|
|
83
|
+
* cell's output; cells never emit them themselves.
|
|
84
|
+
*
|
|
85
|
+
* @param inputs - the classified dispatch inputs
|
|
86
|
+
* @returns the lines joined, or `null`
|
|
87
|
+
* @internal
|
|
88
|
+
*/
|
|
89
|
+
const moduleCacheNoteFor = (inputs) => {
|
|
90
|
+
const lines = formatModuleCacheLines(inputs.state.moduleCache);
|
|
91
|
+
return lines.length === 0 ? null : lines.join("\n");
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
80
94
|
* The console-leaks note for a run whose passing tests wrote `console.*`
|
|
81
95
|
* output, or `null` when none did. Appended after the cell's output like the
|
|
82
96
|
* stray-output note; cells never emit it themselves.
|
|
@@ -121,4 +135,4 @@ const scopedCoverageNoteFor = (inputs) => {
|
|
|
121
135
|
return formatScopedCoverageNote(cov.scopedFiles ?? 0, cov.totalFiles);
|
|
122
136
|
};
|
|
123
137
|
|
|
124
|
-
export { consoleLeaksNoteFor, dispatch, dispatcherTable, scopedCoverageNoteFor, strayOutputNoteFor, suggestedActionsNoteFor };
|
|
138
|
+
export { consoleLeaksNoteFor, dispatch, dispatcherTable, moduleCacheNoteFor, scopedCoverageNoteFor, strayOutputNoteFor, suggestedActionsNoteFor };
|
package/dispatcher/helpers.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Doc, Fmt, Render } from "@effected/cli-kit";
|
|
1
2
|
import { formatTotalsLine } from "../counts.js";
|
|
2
3
|
import { formatDisplayDuration } from "../format-duration.js";
|
|
3
4
|
import { statusGlyph } from "../theme.js";
|
|
4
|
-
import {
|
|
5
|
+
import { formatTraceStepLines } from "../trace-steps.js";
|
|
5
6
|
|
|
6
7
|
// src/dispatcher/helpers.ts
|
|
7
8
|
/**
|
|
@@ -74,6 +75,7 @@ const formatFailure = (f, width, link = (_target, label) => label) => {
|
|
|
74
75
|
const parts = [Doc.line([Doc.link({ file: f.modulePath }, f.modulePath, { suffix: false }), Doc.text(` > ${suite}${f.testName}${classification}`)], { wrap: false })];
|
|
75
76
|
if (f.error?.message !== void 0) parts.push(Doc.line(f.error.message.split("\n", 1)[0] ?? "", { truncate: true }));
|
|
76
77
|
if (f.error?.diff !== void 0) parts.push(Doc.diffText(f.error.diff, { truncate: true }));
|
|
78
|
+
for (const line of formatTraceStepLines(f.error?.traceSteps)) parts.push(Doc.line(line, { truncate: true }));
|
|
77
79
|
return Render.ansi([Doc.list([Doc.section(void 0, parts)], { compact: true })], {
|
|
78
80
|
...Render.contextOf({
|
|
79
81
|
audience: "human",
|
package/index.d.ts
CHANGED
|
@@ -91,6 +91,19 @@ export declare const TestRecord: Schema.Struct<{
|
|
|
91
91
|
readonly diff: Schema.optional<Schema.String>;
|
|
92
92
|
readonly expected: Schema.optional<Schema.String>;
|
|
93
93
|
readonly received: Schema.optional<Schema.String>;
|
|
94
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
95
|
+
readonly name: Schema.String;
|
|
96
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
97
|
+
readonly startTime: Schema.Finite;
|
|
98
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
99
|
+
readonly depth: Schema.Finite;
|
|
100
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
101
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
102
|
+
readonly file: Schema.String;
|
|
103
|
+
readonly line: Schema.Finite;
|
|
104
|
+
readonly column: Schema.Finite;
|
|
105
|
+
}>>;
|
|
106
|
+
}>>>;
|
|
94
107
|
}>>;
|
|
95
108
|
}>;
|
|
96
109
|
/** @public */
|
|
@@ -119,6 +132,19 @@ export declare const ModuleRecord: Schema.Struct<{
|
|
|
119
132
|
readonly diff: Schema.optional<Schema.String>;
|
|
120
133
|
readonly expected: Schema.optional<Schema.String>;
|
|
121
134
|
readonly received: Schema.optional<Schema.String>;
|
|
135
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
136
|
+
readonly name: Schema.String;
|
|
137
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
138
|
+
readonly startTime: Schema.Finite;
|
|
139
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
140
|
+
readonly depth: Schema.Finite;
|
|
141
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
142
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
143
|
+
readonly file: Schema.String;
|
|
144
|
+
readonly line: Schema.Finite;
|
|
145
|
+
readonly column: Schema.Finite;
|
|
146
|
+
}>>;
|
|
147
|
+
}>>>;
|
|
122
148
|
}>>;
|
|
123
149
|
}>>;
|
|
124
150
|
/**
|
|
@@ -154,6 +180,19 @@ export declare const FailureRecord: Schema.Struct<{
|
|
|
154
180
|
readonly diff: Schema.optional<Schema.String>;
|
|
155
181
|
readonly expected: Schema.optional<Schema.String>;
|
|
156
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
|
+
}>>>;
|
|
157
196
|
}>>;
|
|
158
197
|
readonly timedOut: Schema.optional<Schema.Boolean>;
|
|
159
198
|
readonly classification: Schema.NullOr<Schema.Literals<readonly ["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
|
|
@@ -276,6 +315,19 @@ export declare const RenderState: Schema.Struct<{
|
|
|
276
315
|
readonly diff: Schema.optional<Schema.String>;
|
|
277
316
|
readonly expected: Schema.optional<Schema.String>;
|
|
278
317
|
readonly received: Schema.optional<Schema.String>;
|
|
318
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
319
|
+
readonly name: Schema.String;
|
|
320
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
321
|
+
readonly startTime: Schema.Finite;
|
|
322
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
323
|
+
readonly depth: Schema.Finite;
|
|
324
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
325
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
326
|
+
readonly file: Schema.String;
|
|
327
|
+
readonly line: Schema.Finite;
|
|
328
|
+
readonly column: Schema.Finite;
|
|
329
|
+
}>>;
|
|
330
|
+
}>>>;
|
|
279
331
|
}>>;
|
|
280
332
|
}>>;
|
|
281
333
|
/**
|
|
@@ -362,6 +414,19 @@ export declare const RenderState: Schema.Struct<{
|
|
|
362
414
|
readonly diff: Schema.optional<Schema.String>;
|
|
363
415
|
readonly expected: Schema.optional<Schema.String>;
|
|
364
416
|
readonly received: Schema.optional<Schema.String>;
|
|
417
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
418
|
+
readonly name: Schema.String;
|
|
419
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
420
|
+
readonly startTime: Schema.Finite;
|
|
421
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
422
|
+
readonly depth: Schema.Finite;
|
|
423
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
424
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
425
|
+
readonly file: Schema.String;
|
|
426
|
+
readonly line: Schema.Finite;
|
|
427
|
+
readonly column: Schema.Finite;
|
|
428
|
+
}>>;
|
|
429
|
+
}>>>;
|
|
365
430
|
}>>;
|
|
366
431
|
readonly timedOut: Schema.optional<Schema.Boolean>;
|
|
367
432
|
readonly classification: Schema.NullOr<Schema.Literals<readonly ["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
|
|
@@ -394,6 +459,19 @@ export declare const RenderState: Schema.Struct<{
|
|
|
394
459
|
readonly diff: Schema.optional<Schema.String>;
|
|
395
460
|
readonly expected: Schema.optional<Schema.String>;
|
|
396
461
|
readonly received: Schema.optional<Schema.String>;
|
|
462
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
463
|
+
readonly name: Schema.String;
|
|
464
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
465
|
+
readonly startTime: Schema.Finite;
|
|
466
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
467
|
+
readonly depth: Schema.Finite;
|
|
468
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
469
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
470
|
+
readonly file: Schema.String;
|
|
471
|
+
readonly line: Schema.Finite;
|
|
472
|
+
readonly column: Schema.Finite;
|
|
473
|
+
}>>;
|
|
474
|
+
}>>>;
|
|
397
475
|
}>>;
|
|
398
476
|
/**
|
|
399
477
|
* What the run wrote straight to the terminal, past Vitest's console
|
|
@@ -430,6 +508,21 @@ export declare const RenderState: Schema.Struct<{
|
|
|
430
508
|
readonly files: Schema.Finite;
|
|
431
509
|
}>>;
|
|
432
510
|
}>>;
|
|
511
|
+
/**
|
|
512
|
+
* Module cache effectiveness per project, folded from
|
|
513
|
+
* `RunFinished.moduleCache`. Absent when the run produced no timing data
|
|
514
|
+
* (issue #741).
|
|
515
|
+
*/
|
|
516
|
+
readonly moduleCache: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
517
|
+
readonly project: Schema.optional<Schema.String>;
|
|
518
|
+
readonly moduleCache: Schema.Struct<{
|
|
519
|
+
readonly enabled: Schema.Boolean;
|
|
520
|
+
readonly transformMs: Schema.Finite;
|
|
521
|
+
readonly trackedMs: Schema.Finite;
|
|
522
|
+
readonly share: Schema.Finite;
|
|
523
|
+
readonly modulesWritten: Schema.optional<Schema.Finite>;
|
|
524
|
+
}>;
|
|
525
|
+
}>>>;
|
|
433
526
|
}>;
|
|
434
527
|
/** @public */
|
|
435
528
|
export type RenderState = typeof RenderState.Type;
|
|
@@ -608,6 +701,19 @@ declare const AgentReport: Schema.Struct<{
|
|
|
608
701
|
readonly diff: Schema.optional<Schema.String>;
|
|
609
702
|
readonly expected: Schema.optional<Schema.String>;
|
|
610
703
|
readonly received: Schema.optional<Schema.String>;
|
|
704
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
705
|
+
readonly name: Schema.String;
|
|
706
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
707
|
+
readonly startTime: Schema.Finite;
|
|
708
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
709
|
+
readonly depth: Schema.Finite;
|
|
710
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
711
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
712
|
+
readonly file: Schema.String;
|
|
713
|
+
readonly line: Schema.Finite;
|
|
714
|
+
readonly column: Schema.Finite;
|
|
715
|
+
}>>;
|
|
716
|
+
}>>>;
|
|
611
717
|
}>>>;
|
|
612
718
|
readonly tests: Schema.$Array<Schema.Struct<{
|
|
613
719
|
readonly name: Schema.String;
|
|
@@ -622,6 +728,19 @@ declare const AgentReport: Schema.Struct<{
|
|
|
622
728
|
readonly diff: Schema.optional<Schema.String>;
|
|
623
729
|
readonly expected: Schema.optional<Schema.String>;
|
|
624
730
|
readonly received: Schema.optional<Schema.String>;
|
|
731
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
732
|
+
readonly name: Schema.String;
|
|
733
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
734
|
+
readonly startTime: Schema.Finite;
|
|
735
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
736
|
+
readonly depth: Schema.Finite;
|
|
737
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
738
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
739
|
+
readonly file: Schema.String;
|
|
740
|
+
readonly line: Schema.Finite;
|
|
741
|
+
readonly column: Schema.Finite;
|
|
742
|
+
}>>;
|
|
743
|
+
}>>>;
|
|
625
744
|
}>>>;
|
|
626
745
|
readonly classification: Schema.optional<Schema.Literals<readonly ["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
|
|
627
746
|
}>>;
|
|
@@ -632,6 +751,19 @@ declare const AgentReport: Schema.Struct<{
|
|
|
632
751
|
readonly diff: Schema.optional<Schema.String>;
|
|
633
752
|
readonly expected: Schema.optional<Schema.String>;
|
|
634
753
|
readonly received: Schema.optional<Schema.String>;
|
|
754
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
755
|
+
readonly name: Schema.String;
|
|
756
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
757
|
+
readonly startTime: Schema.Finite;
|
|
758
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
759
|
+
readonly depth: Schema.Finite;
|
|
760
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
761
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
762
|
+
readonly file: Schema.String;
|
|
763
|
+
readonly line: Schema.Finite;
|
|
764
|
+
readonly column: Schema.Finite;
|
|
765
|
+
}>>;
|
|
766
|
+
}>>>;
|
|
635
767
|
}>>;
|
|
636
768
|
readonly failedFiles: Schema.$Array<Schema.String>;
|
|
637
769
|
readonly coverage: Schema.optional<Schema.Struct<{
|
|
@@ -772,6 +904,17 @@ declare const AgentReport: Schema.Struct<{
|
|
|
772
904
|
readonly text: Schema.String;
|
|
773
905
|
}>>;
|
|
774
906
|
}>>;
|
|
907
|
+
/**
|
|
908
|
+
* How well Vitest's fs module cache served this project's run (issue
|
|
909
|
+
* #741). Omitted when the run produced no timing data.
|
|
910
|
+
*/
|
|
911
|
+
readonly moduleCache: Schema.optional<Schema.Struct<{
|
|
912
|
+
readonly enabled: Schema.Boolean;
|
|
913
|
+
readonly transformMs: Schema.Finite;
|
|
914
|
+
readonly trackedMs: Schema.Finite;
|
|
915
|
+
readonly share: Schema.Finite;
|
|
916
|
+
readonly modulesWritten: Schema.optional<Schema.Finite>;
|
|
917
|
+
}>>;
|
|
775
918
|
}>;
|
|
776
919
|
/** @public */
|
|
777
920
|
type AgentReport = typeof AgentReport.Type;
|
|
@@ -850,6 +993,19 @@ export declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunSt
|
|
|
850
993
|
readonly diff: Schema.optional<Schema.String>;
|
|
851
994
|
readonly expected: Schema.optional<Schema.String>;
|
|
852
995
|
readonly received: Schema.optional<Schema.String>;
|
|
996
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
997
|
+
readonly name: Schema.String;
|
|
998
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
999
|
+
readonly startTime: Schema.Finite;
|
|
1000
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
1001
|
+
readonly depth: Schema.Finite;
|
|
1002
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
1003
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
1004
|
+
readonly file: Schema.String;
|
|
1005
|
+
readonly line: Schema.Finite;
|
|
1006
|
+
readonly column: Schema.Finite;
|
|
1007
|
+
}>>;
|
|
1008
|
+
}>>>;
|
|
853
1009
|
}>>;
|
|
854
1010
|
readonly timedOut: Schema.optional<Schema.Boolean>;
|
|
855
1011
|
}>, Schema.TaggedStruct<"ModuleFinished", {
|
|
@@ -892,6 +1048,19 @@ export declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunSt
|
|
|
892
1048
|
readonly diff: Schema.optional<Schema.String>;
|
|
893
1049
|
readonly expected: Schema.optional<Schema.String>;
|
|
894
1050
|
readonly received: Schema.optional<Schema.String>;
|
|
1051
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
1052
|
+
readonly name: Schema.String;
|
|
1053
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
1054
|
+
readonly startTime: Schema.Finite;
|
|
1055
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
1056
|
+
readonly depth: Schema.Finite;
|
|
1057
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
1058
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
1059
|
+
readonly file: Schema.String;
|
|
1060
|
+
readonly line: Schema.Finite;
|
|
1061
|
+
readonly column: Schema.Finite;
|
|
1062
|
+
}>>;
|
|
1063
|
+
}>>>;
|
|
895
1064
|
}>>;
|
|
896
1065
|
}>, Schema.TaggedStruct<"ConsoleLog", {
|
|
897
1066
|
readonly modulePath: Schema.optional<Schema.String>;
|
|
@@ -1024,6 +1193,19 @@ export declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunSt
|
|
|
1024
1193
|
readonly diff: Schema.optional<Schema.String>;
|
|
1025
1194
|
readonly expected: Schema.optional<Schema.String>;
|
|
1026
1195
|
readonly received: Schema.optional<Schema.String>;
|
|
1196
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
1197
|
+
readonly name: Schema.String;
|
|
1198
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
1199
|
+
readonly startTime: Schema.Finite;
|
|
1200
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
1201
|
+
readonly depth: Schema.Finite;
|
|
1202
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
1203
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
1204
|
+
readonly file: Schema.String;
|
|
1205
|
+
readonly line: Schema.Finite;
|
|
1206
|
+
readonly column: Schema.Finite;
|
|
1207
|
+
}>>;
|
|
1208
|
+
}>>>;
|
|
1027
1209
|
}>>>;
|
|
1028
1210
|
/**
|
|
1029
1211
|
* What the run wrote straight to the terminal, past Vitest's console
|
|
@@ -1060,6 +1242,22 @@ export declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunSt
|
|
|
1060
1242
|
readonly files: Schema.Finite;
|
|
1061
1243
|
}>>;
|
|
1062
1244
|
}>>;
|
|
1245
|
+
/**
|
|
1246
|
+
* How well Vitest's fs module cache served each project's run
|
|
1247
|
+
* (`AgentReport.moduleCache`), one entry per project that has data.
|
|
1248
|
+
* Optional: absent when no project produced timing data, and in older
|
|
1249
|
+
* replay data (issue #741).
|
|
1250
|
+
*/
|
|
1251
|
+
readonly moduleCache: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
1252
|
+
readonly project: Schema.optional<Schema.String>;
|
|
1253
|
+
readonly moduleCache: Schema.Struct<{
|
|
1254
|
+
readonly enabled: Schema.Boolean;
|
|
1255
|
+
readonly transformMs: Schema.Finite;
|
|
1256
|
+
readonly trackedMs: Schema.Finite;
|
|
1257
|
+
readonly share: Schema.Finite;
|
|
1258
|
+
readonly modulesWritten: Schema.optional<Schema.Finite>;
|
|
1259
|
+
}>;
|
|
1260
|
+
}>>>;
|
|
1063
1261
|
}>]>;
|
|
1064
1262
|
/** @public */
|
|
1065
1263
|
export type RunEvent = typeof RunEvent.Type;
|
|
@@ -1132,6 +1330,14 @@ interface VitestTestDiagnostic {
|
|
|
1132
1330
|
duration: number;
|
|
1133
1331
|
flaky: boolean;
|
|
1134
1332
|
slow: boolean;
|
|
1333
|
+
/**
|
|
1334
|
+
* Retries used by the test (Vitest 5.1+). A retry is counted only after a
|
|
1335
|
+
* failed attempt, but the count accumulates across repeats, so it can be
|
|
1336
|
+
* non-zero when the final repeat passed.
|
|
1337
|
+
*/
|
|
1338
|
+
retryCount?: number;
|
|
1339
|
+
/** Repeats run by the test (Vitest 5.1+). */
|
|
1340
|
+
repeatCount?: number;
|
|
1135
1341
|
}
|
|
1136
1342
|
/**
|
|
1137
1343
|
* Duck-typed Vitest TestCase from the Reporter v2 API.
|
|
@@ -1151,6 +1357,14 @@ interface VitestTestCase {
|
|
|
1151
1357
|
/** Parent suite or module. Optional in the duck-type so unit-test fixtures don't have to fabricate a stub; always present in real Vitest TestCase instances. */
|
|
1152
1358
|
parent?: VitestTestSuite | VitestTestModule;
|
|
1153
1359
|
result(): VitestTestResult | undefined;
|
|
1360
|
+
/** Per-attempt results, one per retry and repeat (Vitest 5.1+). */
|
|
1361
|
+
attempts?(): ReadonlyArray<{
|
|
1362
|
+
errors?: ReadonlyArray<VitestTestError> | undefined;
|
|
1363
|
+
retryIndex?: number;
|
|
1364
|
+
repeatIndex?: number;
|
|
1365
|
+
}>;
|
|
1366
|
+
/** Recorded artifacts; Vitest 5.1 `traceTimeline` adds an `internal:browserTrace` one (read, never persisted as a user artifact). */
|
|
1367
|
+
artifacts?(): ReadonlyArray<unknown>;
|
|
1154
1368
|
diagnostic(): VitestTestDiagnostic | undefined;
|
|
1155
1369
|
}
|
|
1156
1370
|
/**
|
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ActionSeverity, CoverageFile, CoverageGap, CoverageMetric, CoverageRenderState, FailureRecord, ModuleRecord, RenderState, RenderTotals, RunEvent, SuggestedActionRecord, TestRecord, initialRenderState } from "@vitest-agent/sdk";
|
|
1
2
|
import { classifyOutcome, classifyRunShape } from "./dispatcher/classify.js";
|
|
2
3
|
import { dispatch, dispatcherTable } from "./dispatcher/dispatch.js";
|
|
3
4
|
import { buildFooter, dominantClassification } from "./dispatcher/footer.js";
|
|
@@ -8,7 +9,6 @@ import { renderAgent } from "./render-agent.js";
|
|
|
8
9
|
import { SPINNER_FRAMES, SPINNER_FRAME_MS, spinnerFrame } from "./spinner.js";
|
|
9
10
|
import { SUITE_FAILURE_LABEL, SUITE_LOAD_FAILURE_LABEL, synthesizeFromAgentReport, synthesizeRunEvents } from "./synthesize.js";
|
|
10
11
|
import { VitestAgentStatus, VitestAgentTokens, inkStyle, statusGlyph, statusInkStyle } from "./theme.js";
|
|
11
|
-
import { ActionSeverity, CoverageFile, CoverageGap, CoverageMetric, CoverageRenderState, FailureRecord, ModuleRecord, RenderState, RenderTotals, RunEvent, SuggestedActionRecord, TestRecord, initialRenderState } from "@vitest-agent/sdk";
|
|
12
12
|
|
|
13
13
|
// src/index.ts
|
|
14
14
|
/**
|
|
@@ -18,6 +18,6 @@ import { ActionSeverity, CoverageFile, CoverageGap, CoverageMetric, CoverageRend
|
|
|
18
18
|
*
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
|
-
const CURRENT_UI_VERSION = "6.0
|
|
21
|
+
const CURRENT_UI_VERSION = "6.1.0";
|
|
22
22
|
|
|
23
23
|
export { ActionSeverity, CURRENT_UI_VERSION, CoverageFile, CoverageGap, CoverageMetric, CoverageRenderState, FailureRecord, ModuleRecord, RenderState, RenderTotals, RunEvent, SPINNER_FRAMES, SPINNER_FRAME_MS, SUITE_FAILURE_LABEL, SUITE_LOAD_FAILURE_LABEL, SuggestedActionRecord, TestRecord, VitestAgentStatus, VitestAgentTokens, buildFooter, classifyOutcome, classifyRunShape, dispatch, dispatcherTable, dominantClassification, formatDisplayDuration, formatSuggestedActionLines, initialRenderState, inkStyle, reduceRenderState, reduceRenderStateAll, renderAgent, spinnerFrame, statusGlyph, statusInkStyle, synthesizeFromAgentReport, synthesizeRunEvents };
|
package/ink/CountColumns.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { VitestAgentTokens, statusGlyph, statusToken } from "../theme.js";
|
|
2
1
|
import { Fmt } from "@effected/cli-kit";
|
|
3
2
|
import { Styled, useGlyphs } from "@effected/cli-kit/ui";
|
|
4
3
|
import { Text } from "ink";
|
|
4
|
+
import { VitestAgentTokens, statusGlyph, statusToken } from "../theme.js";
|
|
5
5
|
import { jsxs } from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
// src/ink/CountColumns.tsx
|
package/ink/CoverageBlock.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useFileLink } from "./FileLink.js";
|
|
2
1
|
import { Fmt } from "@effected/cli-kit";
|
|
3
2
|
import { useStyle } from "@effected/cli-kit/ui";
|
|
4
3
|
import { Box, Text } from "ink";
|
|
4
|
+
import { useFileLink } from "./FileLink.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
// src/ink/CoverageBlock.tsx
|
package/ink/FailureSection.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { statusGlyph, statusToken } from "../theme.js";
|
|
2
|
-
import { useFileLink } from "./FileLink.js";
|
|
3
1
|
import { Styled, useGlyphs, useStyle } from "@effected/cli-kit/ui";
|
|
4
2
|
import { Box, Text } from "ink";
|
|
3
|
+
import { statusGlyph, statusToken } from "../theme.js";
|
|
4
|
+
import { formatTraceStepLines } from "../trace-steps.js";
|
|
5
|
+
import { useFileLink } from "./FileLink.js";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
|
|
7
8
|
// src/ink/FailureSection.tsx
|
|
@@ -47,6 +48,13 @@ const FailureRow = ({ failure, includeStack }) => {
|
|
|
47
48
|
}, key);
|
|
48
49
|
return /* @__PURE__ */ jsx(Text, { children: ` ${line}` }, key);
|
|
49
50
|
}) : null,
|
|
51
|
+
formatTraceStepLines(failure.error?.traceSteps).map((line, idx) => {
|
|
52
|
+
const key = `trace-${idx}`;
|
|
53
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
54
|
+
dimColor: true,
|
|
55
|
+
children: ` ${line}`
|
|
56
|
+
}, key);
|
|
57
|
+
}),
|
|
50
58
|
includeStack && failure.error?.stack !== void 0 ? failure.error.stack.split("\n").map((line, idx) => {
|
|
51
59
|
const key = `stack-${idx}`;
|
|
52
60
|
return /* @__PURE__ */ jsx(Text, {
|
package/ink/FailuresSection.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { VitestAgentTokens, statusGlyph, statusToken } from "../theme.js";
|
|
2
|
-
import { useFileLink } from "./FileLink.js";
|
|
3
1
|
import { Styled, useGlyphs } from "@effected/cli-kit/ui";
|
|
4
2
|
import { Box, Text } from "ink";
|
|
3
|
+
import { VitestAgentTokens, statusGlyph, statusToken } from "../theme.js";
|
|
4
|
+
import { useFileLink } from "./FileLink.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
// src/ink/FailuresSection.tsx
|
package/ink/FileLink.js
CHANGED
package/ink/ModuleHeader.js
CHANGED
package/ink/ProjectRow.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { Fmt } from "@effected/cli-kit";
|
|
2
|
+
import { Styled } from "@effected/cli-kit/ui";
|
|
3
|
+
import { Box, Text } from "ink";
|
|
1
4
|
import { formatDisplayDuration } from "../format-duration.js";
|
|
2
5
|
import { statusToken } from "../theme.js";
|
|
3
6
|
import { CountColumns, DURATION_CELL_WIDTH } from "./CountColumns.js";
|
|
4
7
|
import { StatusIcon } from "./StatusIcon.js";
|
|
5
8
|
import { TagColumns } from "./TagColumns.js";
|
|
6
|
-
import { Fmt } from "@effected/cli-kit";
|
|
7
|
-
import { Styled } from "@effected/cli-kit/ui";
|
|
8
|
-
import { Box, Text } from "ink";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
|
|
11
11
|
// src/ink/ProjectRow.tsx
|
package/ink/StatusIcon.js
CHANGED
package/ink/StreamApp.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { Fmt } from "@effected/cli-kit";
|
|
2
|
+
import { Styled, useGlyphs, useStyle } from "@effected/cli-kit/ui";
|
|
3
|
+
import { formatConsoleLeaksNote, formatModuleCacheLines, formatStrayOutputNote } from "@vitest-agent/sdk";
|
|
4
|
+
import { Box, Text } from "ink";
|
|
1
5
|
import { classifyRunShape } from "../dispatcher/classify.js";
|
|
2
6
|
import { formatDisplayDuration } from "../format-duration.js";
|
|
3
7
|
import { spinnerFrame } from "../spinner.js";
|
|
@@ -9,10 +13,6 @@ import { StatusIcon } from "./StatusIcon.js";
|
|
|
9
13
|
import { TagColumns, tagUnion } from "./TagColumns.js";
|
|
10
14
|
import { TestRow } from "./TestRow.js";
|
|
11
15
|
import { TrendLine } from "./TrendLine.js";
|
|
12
|
-
import { formatConsoleLeaksNote, formatStrayOutputNote } from "@vitest-agent/sdk";
|
|
13
|
-
import { Fmt } from "@effected/cli-kit";
|
|
14
|
-
import { Styled, useGlyphs, useStyle } from "@effected/cli-kit/ui";
|
|
15
|
-
import { Box, Text } from "ink";
|
|
16
16
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
17
17
|
|
|
18
18
|
// src/ink/StreamApp.tsx
|
|
@@ -523,10 +523,16 @@ const StreamApp = ({ state, frameIndex, nowMs }) => {
|
|
|
523
523
|
const stray = state.strayOutput !== void 0 ? formatStrayOutputNote(state.strayOutput) : null;
|
|
524
524
|
const leakLines = state.consoleLeaks !== void 0 ? formatConsoleLeaksNote(state.consoleLeaks) : [];
|
|
525
525
|
const leaks = leakLines.length > 0 ? leakLines : null;
|
|
526
|
+
const cacheLines = formatModuleCacheLines(state.moduleCache);
|
|
526
527
|
return /* @__PURE__ */ jsxs(Box, {
|
|
527
528
|
flexDirection: "column",
|
|
528
529
|
children: [
|
|
529
530
|
liveContent,
|
|
531
|
+
cacheLines.length > 0 ? /* @__PURE__ */ jsx(Box, {
|
|
532
|
+
flexDirection: "column",
|
|
533
|
+
marginTop: 1,
|
|
534
|
+
children: cacheLines.map((line, i) => /* @__PURE__ */ jsx(Text, { children: line }, `cache:${i}`))
|
|
535
|
+
}) : null,
|
|
530
536
|
stray !== null ? /* @__PURE__ */ jsx(Box, {
|
|
531
537
|
flexDirection: "column",
|
|
532
538
|
marginTop: 1,
|
package/ink/TagColumns.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { VitestAgentTokens } from "../theme.js";
|
|
2
1
|
import { Fmt } from "@effected/cli-kit";
|
|
3
2
|
import { Styled } from "@effected/cli-kit/ui";
|
|
4
3
|
import { Text } from "ink";
|
|
4
|
+
import { VitestAgentTokens } from "../theme.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
// src/ink/TagColumns.tsx
|
package/ink/TestRow.js
CHANGED
package/ink/TrendLine.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { VitestAgentTokens } from "../theme.js";
|
|
2
1
|
import { Fmt } from "@effected/cli-kit";
|
|
3
2
|
import { Styled } from "@effected/cli-kit/ui";
|
|
4
3
|
import { Text } from "ink";
|
|
4
|
+
import { VitestAgentTokens } from "../theme.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
// src/ink/TrendLine.tsx
|
package/ink/dispatch-ink.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { consoleLeaksNoteFor, dispatcherTable, scopedCoverageNoteFor, strayOutputNoteFor, suggestedActionsNoteFor } from "../dispatcher/dispatch.js";
|
|
2
|
-
import { renderAgentStringAsInk } from "./ink-helpers.js";
|
|
3
1
|
import { Box, Text } from "ink";
|
|
4
2
|
import { createElement } from "react";
|
|
3
|
+
import { consoleLeaksNoteFor, dispatcherTable, moduleCacheNoteFor, scopedCoverageNoteFor, strayOutputNoteFor, suggestedActionsNoteFor } from "../dispatcher/dispatch.js";
|
|
4
|
+
import { renderAgentStringAsInk } from "./ink-helpers.js";
|
|
5
5
|
|
|
6
6
|
// src/ink/dispatch-ink.ts
|
|
7
7
|
/** The Ink half of a cell whose live view is its agent string, painted. */
|
|
@@ -58,6 +58,7 @@ const dispatchInk = (inputs, opts) => {
|
|
|
58
58
|
const element = cell(inputs, opts);
|
|
59
59
|
const note = scopedCoverageNoteFor(inputs);
|
|
60
60
|
const trailers = [
|
|
61
|
+
moduleCacheNoteFor(inputs),
|
|
61
62
|
suggestedActionsNoteFor(inputs),
|
|
62
63
|
strayOutputNoteFor(inputs),
|
|
63
64
|
consoleLeaksNoteFor(inputs)
|
package/ink/ink-helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { statusGlyph, statusToken } from "../theme.js";
|
|
2
1
|
import { Styled } from "@effected/cli-kit/ui";
|
|
3
2
|
import { Box, Text } from "ink";
|
|
3
|
+
import { statusGlyph, statusToken } from "../theme.js";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
// src/ink/ink-helpers.tsx
|
package/ink.d.ts
CHANGED
|
@@ -44,6 +44,19 @@ declare const TestRecord: Schema.Struct<{
|
|
|
44
44
|
readonly diff: Schema.optional<Schema.String>;
|
|
45
45
|
readonly expected: Schema.optional<Schema.String>;
|
|
46
46
|
readonly received: Schema.optional<Schema.String>;
|
|
47
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
48
|
+
readonly name: Schema.String;
|
|
49
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
50
|
+
readonly startTime: Schema.Finite;
|
|
51
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
52
|
+
readonly depth: Schema.Finite;
|
|
53
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
54
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
55
|
+
readonly file: Schema.String;
|
|
56
|
+
readonly line: Schema.Finite;
|
|
57
|
+
readonly column: Schema.Finite;
|
|
58
|
+
}>>;
|
|
59
|
+
}>>>;
|
|
47
60
|
}>>;
|
|
48
61
|
}>;
|
|
49
62
|
/** @public */
|
|
@@ -72,6 +85,19 @@ declare const ModuleRecord: Schema.Struct<{
|
|
|
72
85
|
readonly diff: Schema.optional<Schema.String>;
|
|
73
86
|
readonly expected: Schema.optional<Schema.String>;
|
|
74
87
|
readonly received: Schema.optional<Schema.String>;
|
|
88
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
89
|
+
readonly name: Schema.String;
|
|
90
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
91
|
+
readonly startTime: Schema.Finite;
|
|
92
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
93
|
+
readonly depth: Schema.Finite;
|
|
94
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
95
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
96
|
+
readonly file: Schema.String;
|
|
97
|
+
readonly line: Schema.Finite;
|
|
98
|
+
readonly column: Schema.Finite;
|
|
99
|
+
}>>;
|
|
100
|
+
}>>>;
|
|
75
101
|
}>>;
|
|
76
102
|
}>>;
|
|
77
103
|
/**
|
|
@@ -107,6 +133,19 @@ declare const FailureRecord: Schema.Struct<{
|
|
|
107
133
|
readonly diff: Schema.optional<Schema.String>;
|
|
108
134
|
readonly expected: Schema.optional<Schema.String>;
|
|
109
135
|
readonly received: Schema.optional<Schema.String>;
|
|
136
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
137
|
+
readonly name: Schema.String;
|
|
138
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
139
|
+
readonly startTime: Schema.Finite;
|
|
140
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
141
|
+
readonly depth: Schema.Finite;
|
|
142
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
143
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
144
|
+
readonly file: Schema.String;
|
|
145
|
+
readonly line: Schema.Finite;
|
|
146
|
+
readonly column: Schema.Finite;
|
|
147
|
+
}>>;
|
|
148
|
+
}>>>;
|
|
110
149
|
}>>;
|
|
111
150
|
readonly timedOut: Schema.optional<Schema.Boolean>;
|
|
112
151
|
readonly classification: Schema.NullOr<Schema.Literals<readonly ["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
|
|
@@ -215,6 +254,19 @@ declare const RenderState: Schema.Struct<{
|
|
|
215
254
|
readonly diff: Schema.optional<Schema.String>;
|
|
216
255
|
readonly expected: Schema.optional<Schema.String>;
|
|
217
256
|
readonly received: Schema.optional<Schema.String>;
|
|
257
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
258
|
+
readonly name: Schema.String;
|
|
259
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
260
|
+
readonly startTime: Schema.Finite;
|
|
261
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
262
|
+
readonly depth: Schema.Finite;
|
|
263
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
264
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
265
|
+
readonly file: Schema.String;
|
|
266
|
+
readonly line: Schema.Finite;
|
|
267
|
+
readonly column: Schema.Finite;
|
|
268
|
+
}>>;
|
|
269
|
+
}>>>;
|
|
218
270
|
}>>;
|
|
219
271
|
}>>;
|
|
220
272
|
/**
|
|
@@ -301,6 +353,19 @@ declare const RenderState: Schema.Struct<{
|
|
|
301
353
|
readonly diff: Schema.optional<Schema.String>;
|
|
302
354
|
readonly expected: Schema.optional<Schema.String>;
|
|
303
355
|
readonly received: Schema.optional<Schema.String>;
|
|
356
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
357
|
+
readonly name: Schema.String;
|
|
358
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
359
|
+
readonly startTime: Schema.Finite;
|
|
360
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
361
|
+
readonly depth: Schema.Finite;
|
|
362
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
363
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
364
|
+
readonly file: Schema.String;
|
|
365
|
+
readonly line: Schema.Finite;
|
|
366
|
+
readonly column: Schema.Finite;
|
|
367
|
+
}>>;
|
|
368
|
+
}>>>;
|
|
304
369
|
}>>;
|
|
305
370
|
readonly timedOut: Schema.optional<Schema.Boolean>;
|
|
306
371
|
readonly classification: Schema.NullOr<Schema.Literals<readonly ["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
|
|
@@ -333,6 +398,19 @@ declare const RenderState: Schema.Struct<{
|
|
|
333
398
|
readonly diff: Schema.optional<Schema.String>;
|
|
334
399
|
readonly expected: Schema.optional<Schema.String>;
|
|
335
400
|
readonly received: Schema.optional<Schema.String>;
|
|
401
|
+
readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
402
|
+
readonly name: Schema.String;
|
|
403
|
+
readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
|
|
404
|
+
readonly startTime: Schema.Finite;
|
|
405
|
+
readonly duration: Schema.optional<Schema.Finite>;
|
|
406
|
+
readonly depth: Schema.Finite;
|
|
407
|
+
readonly locator: Schema.optional<Schema.String>;
|
|
408
|
+
readonly location: Schema.optional<Schema.Struct<{
|
|
409
|
+
readonly file: Schema.String;
|
|
410
|
+
readonly line: Schema.Finite;
|
|
411
|
+
readonly column: Schema.Finite;
|
|
412
|
+
}>>;
|
|
413
|
+
}>>>;
|
|
336
414
|
}>>;
|
|
337
415
|
/**
|
|
338
416
|
* What the run wrote straight to the terminal, past Vitest's console
|
|
@@ -369,6 +447,21 @@ declare const RenderState: Schema.Struct<{
|
|
|
369
447
|
readonly files: Schema.Finite;
|
|
370
448
|
}>>;
|
|
371
449
|
}>>;
|
|
450
|
+
/**
|
|
451
|
+
* Module cache effectiveness per project, folded from
|
|
452
|
+
* `RunFinished.moduleCache`. Absent when the run produced no timing data
|
|
453
|
+
* (issue #741).
|
|
454
|
+
*/
|
|
455
|
+
readonly moduleCache: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
456
|
+
readonly project: Schema.optional<Schema.String>;
|
|
457
|
+
readonly moduleCache: Schema.Struct<{
|
|
458
|
+
readonly enabled: Schema.Boolean;
|
|
459
|
+
readonly transformMs: Schema.Finite;
|
|
460
|
+
readonly trackedMs: Schema.Finite;
|
|
461
|
+
readonly share: Schema.Finite;
|
|
462
|
+
readonly modulesWritten: Schema.optional<Schema.Finite>;
|
|
463
|
+
}>;
|
|
464
|
+
}>>>;
|
|
372
465
|
}>;
|
|
373
466
|
/** @public */
|
|
374
467
|
type RenderState = typeof RenderState.Type;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest-agent/ui",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Shared event-sourced renderer for vitest-agent. React Ink view for humans, plain-string view for agents, both fed by the same reducer over a RunEvent stream.",
|
|
6
6
|
"keywords": [
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"./package.json": "./package.json"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@vitest-agent/sdk": "9.0
|
|
48
|
-
"effect": "4.1.
|
|
47
|
+
"@vitest-agent/sdk": "9.2.0",
|
|
48
|
+
"effect": "4.1.5"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@effected/cli-kit": "^0.30.0",
|
package/reducer.js
CHANGED
|
@@ -226,7 +226,8 @@ const reduceRenderState = (state, event) => {
|
|
|
226
226
|
...e.collectedModules !== void 0 && { collectedModules: e.collectedModules },
|
|
227
227
|
...e.unhandledErrors !== void 0 && { unhandledErrors: e.unhandledErrors },
|
|
228
228
|
...e.strayOutput !== void 0 && { strayOutput: e.strayOutput },
|
|
229
|
-
...e.consoleLeaks !== void 0 && { consoleLeaks: e.consoleLeaks }
|
|
229
|
+
...e.consoleLeaks !== void 0 && { consoleLeaks: e.consoleLeaks },
|
|
230
|
+
...e.moduleCache !== void 0 && { moduleCache: e.moduleCache }
|
|
230
231
|
}),
|
|
231
232
|
RunTimedOut: () => ({
|
|
232
233
|
...state,
|
package/render-agent.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Fmt } from "@effected/cli-kit";
|
|
2
|
+
import { formatConsoleLeaksNote, formatModuleCacheLines, formatStrayOutputNote } from "@vitest-agent/sdk";
|
|
1
3
|
import { formatTotalsLine } from "./counts.js";
|
|
2
4
|
import { formatFailure as formatFailure$1, formatGlobShortfallLines, formatSuggestedActionLines } from "./dispatcher/helpers.js";
|
|
3
|
-
import { formatConsoleLeaksNote, formatStrayOutputNote } from "@vitest-agent/sdk";
|
|
4
|
-
import { Fmt } from "@effected/cli-kit";
|
|
5
5
|
|
|
6
6
|
// src/render-agent.ts
|
|
7
7
|
/**
|
|
@@ -104,6 +104,10 @@ const formatActionsSection = (state) => {
|
|
|
104
104
|
const lines = formatSuggestedActionLines(state.suggestedActions);
|
|
105
105
|
return lines.length === 0 ? null : lines.join("\n");
|
|
106
106
|
};
|
|
107
|
+
const formatModuleCacheSection = (state) => {
|
|
108
|
+
const lines = formatModuleCacheLines(state.moduleCache);
|
|
109
|
+
return lines.length === 0 ? null : lines.join("\n");
|
|
110
|
+
};
|
|
107
111
|
const formatConsoleLeaksSection = (state) => {
|
|
108
112
|
if (state.consoleLeaks === void 0) return null;
|
|
109
113
|
const lines = formatConsoleLeaksNote(state.consoleLeaks);
|
|
@@ -134,6 +138,8 @@ const renderAgent = (state, options = {}) => {
|
|
|
134
138
|
if (modules !== null) sections.push(modules);
|
|
135
139
|
const coverage = formatCoverageSection(state, maxGaps);
|
|
136
140
|
if (coverage !== null) sections.push(coverage);
|
|
141
|
+
const moduleCache = formatModuleCacheSection(state);
|
|
142
|
+
if (moduleCache !== null) sections.push(moduleCache);
|
|
137
143
|
const actions = formatActionsSection(state);
|
|
138
144
|
if (actions !== null) sections.push(actions);
|
|
139
145
|
if (state.strayOutput !== void 0) sections.push(formatStrayOutputNote(state.strayOutput).join("\n"));
|
package/synthesize.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isTimeoutError } from "@vitest-agent/sdk";
|
|
1
|
+
import { finalAttemptErrors, isTimeoutError } from "@vitest-agent/sdk";
|
|
2
2
|
|
|
3
3
|
// src/synthesize.ts
|
|
4
4
|
/**
|
|
@@ -112,8 +112,9 @@ const synthesizeRunEvents = (modules, options = {}) => {
|
|
|
112
112
|
testName: test.name,
|
|
113
113
|
suitePath
|
|
114
114
|
});
|
|
115
|
-
const
|
|
116
|
-
const
|
|
115
|
+
const finalErrors = finalAttemptErrors(test);
|
|
116
|
+
const error = mapTestError(finalErrors);
|
|
117
|
+
const firstErrorMsg = finalErrors?.[0]?.message;
|
|
117
118
|
const timedOut = status === "failed" && firstErrorMsg !== void 0 && isTimeoutError({ message: firstErrorMsg });
|
|
118
119
|
if (timedOut) moduleTimeout++;
|
|
119
120
|
events.push({
|
|
@@ -388,7 +389,11 @@ const synthesizeFromAgentReport = (report, options = {}) => {
|
|
|
388
389
|
...report.summary.modules !== void 0 && { collectedModules: report.summary.modules },
|
|
389
390
|
...report.unhandledErrors.length > 0 && { unhandledErrors: report.unhandledErrors },
|
|
390
391
|
...report.strayOutput !== void 0 && { strayOutput: report.strayOutput },
|
|
391
|
-
...report.consoleLeaks !== void 0 && { consoleLeaks: report.consoleLeaks }
|
|
392
|
+
...report.consoleLeaks !== void 0 && { consoleLeaks: report.consoleLeaks },
|
|
393
|
+
...report.moduleCache !== void 0 && { moduleCache: [{
|
|
394
|
+
...report.project !== void 0 && { project: report.project },
|
|
395
|
+
moduleCache: report.moduleCache
|
|
396
|
+
}] }
|
|
392
397
|
});
|
|
393
398
|
return events;
|
|
394
399
|
};
|
package/trace-steps.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/trace-steps.ts
|
|
2
|
+
const ms = (value) => `${Math.round(value)}ms`;
|
|
3
|
+
/**
|
|
4
|
+
* One line per step, indented two spaces per nesting level, e.g.
|
|
5
|
+
* `click [button] +12ms 3ms src/a.test.ts:4:7 FAIL`.
|
|
6
|
+
*
|
|
7
|
+
* @param steps - the failed attempt's steps, oldest first
|
|
8
|
+
* @returns the lines with a leading `Trace:` header, or `[]` when there are no steps
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
const formatTraceStepLines = (steps) => {
|
|
12
|
+
if (steps === void 0 || steps.length === 0) return [];
|
|
13
|
+
return ["Trace:", ...steps.map((step) => {
|
|
14
|
+
const parts = [`${" ".repeat(Math.max(0, step.depth))}${step.name}${step.locator !== void 0 ? ` [${step.locator}]` : ""}`, `+${ms(step.startTime)}`];
|
|
15
|
+
if (step.duration !== void 0) parts.push(ms(step.duration));
|
|
16
|
+
if (step.location !== void 0) parts.push(`${step.location.file}:${step.location.line}:${step.location.column}`);
|
|
17
|
+
if (step.status === "fail") parts.push("FAIL");
|
|
18
|
+
return ` ${parts.join(" ")}`;
|
|
19
|
+
})];
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { formatTraceStepLines };
|