@vitest-agent/reporter 2.2.1 → 2.2.3
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 +12 -2
- package/index.d.ts +38 -0
- package/index.js +1 -1
- package/package.json +3 -3
package/defaultReporter.js
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import { renderGithubLog, toDisplayPath } from "./githubLog.js";
|
|
2
2
|
import { createLiveInk } from "./LiveInkRenderer.js";
|
|
3
|
-
import { countSuiteFailures } from "@vitest-agent/sdk";
|
|
3
|
+
import { countSuiteFailures, isTimeoutError } from "@vitest-agent/sdk";
|
|
4
4
|
import { classifyOutcome, classifyRunShape, dispatch, dispatcherTable, reduceRenderStateAll, synthesizeFromAgentReport } from "@vitest-agent/ui";
|
|
5
5
|
import { Effect, PubSub } from "effect";
|
|
6
6
|
|
|
7
7
|
//#region src/defaultReporter.ts
|
|
8
|
+
const countTimeouts = (report) => {
|
|
9
|
+
let timeoutCount = 0;
|
|
10
|
+
for (const mod of report.failed) for (const test of mod.tests) {
|
|
11
|
+
const firstError = test.errors?.[0];
|
|
12
|
+
if (test.state === "failed" && firstError !== void 0 && isTimeoutError({ message: firstError.message })) timeoutCount++;
|
|
13
|
+
}
|
|
14
|
+
return timeoutCount;
|
|
15
|
+
};
|
|
8
16
|
const summarizeProject = (report) => {
|
|
9
17
|
const collapsedTagCounts = report.tagCounts !== void 0 ? collapseTagCounts(report.tagCounts) : void 0;
|
|
10
18
|
const tagCountsHasEntries = collapsedTagCounts !== void 0 && Object.keys(collapsedTagCounts).length > 0;
|
|
11
19
|
const belowTargetCount = report.coverage?.belowTargetFiles?.length;
|
|
12
20
|
const violationsCount = report.coverage !== void 0 && report.coverage.lowCoverage.length > 0 ? report.coverage.lowCoverage.length : void 0;
|
|
21
|
+
const timeoutCount = countTimeouts(report);
|
|
13
22
|
return {
|
|
14
23
|
name: report.project ?? "default",
|
|
15
24
|
passCount: report.summary.passed,
|
|
16
|
-
failCount: report.summary.failed + countSuiteFailures(report),
|
|
25
|
+
failCount: report.summary.failed + countSuiteFailures(report) - timeoutCount,
|
|
17
26
|
skipCount: report.summary.skipped,
|
|
18
27
|
durationMs: report.summary.duration,
|
|
28
|
+
...timeoutCount > 0 ? { timeoutCount } : {},
|
|
19
29
|
...tagCountsHasEntries && collapsedTagCounts !== void 0 ? { tagCounts: collapsedTagCounts } : {},
|
|
20
30
|
...belowTargetCount !== void 0 ? { belowTarget: belowTargetCount } : {},
|
|
21
31
|
...violationsCount !== void 0 ? { violations: violationsCount } : {}
|
package/index.d.ts
CHANGED
|
@@ -110,6 +110,9 @@ declare const RenderState: Schema.Struct<{
|
|
|
110
110
|
readonly expected: Schema.Number;
|
|
111
111
|
readonly actual: Schema.Number;
|
|
112
112
|
}>>;
|
|
113
|
+
readonly scoped: Schema.optional<Schema.Boolean>;
|
|
114
|
+
readonly scopedFiles: Schema.optional<Schema.Number>;
|
|
115
|
+
readonly totalFiles: Schema.optional<Schema.Number>;
|
|
113
116
|
}>>;
|
|
114
117
|
readonly trend: Schema.NullOr<Schema.Struct<{
|
|
115
118
|
readonly direction: Schema.Literals<readonly ["improving", "regressing", "stable"]>;
|
|
@@ -145,6 +148,19 @@ declare const RenderState: Schema.Struct<{
|
|
|
145
148
|
* fixtures) falls back to `moduleOrder.length`.
|
|
146
149
|
*/
|
|
147
150
|
readonly collectedModules: Schema.optional<Schema.Number>;
|
|
151
|
+
/**
|
|
152
|
+
* Process-level errors with no owning module, folded from
|
|
153
|
+
* `RunFinished.unhandledErrors`. A run that never carried the field
|
|
154
|
+
* (older replay data, hand-built fixtures) defaults to `[]`. See
|
|
155
|
+
* issue #240.
|
|
156
|
+
*/
|
|
157
|
+
readonly unhandledErrors: Schema.$Array<Schema.Struct<{
|
|
158
|
+
readonly message: Schema.String;
|
|
159
|
+
readonly stack: Schema.optional<Schema.String>;
|
|
160
|
+
readonly diff: Schema.optional<Schema.String>;
|
|
161
|
+
readonly expected: Schema.optional<Schema.String>;
|
|
162
|
+
readonly received: Schema.optional<Schema.String>;
|
|
163
|
+
}>>;
|
|
148
164
|
}>;
|
|
149
165
|
/** @public */
|
|
150
166
|
type RenderState = typeof RenderState.Type;
|
|
@@ -187,6 +203,7 @@ interface ProjectSummary {
|
|
|
187
203
|
readonly failCount: number;
|
|
188
204
|
readonly skipCount: number;
|
|
189
205
|
readonly durationMs: number;
|
|
206
|
+
readonly timeoutCount?: number;
|
|
190
207
|
readonly tagCounts?: Record<string, number>;
|
|
191
208
|
readonly belowTarget?: number;
|
|
192
209
|
readonly violations?: number;
|
|
@@ -380,6 +397,7 @@ declare const AgentReport: Schema.Struct<{
|
|
|
380
397
|
}>>;
|
|
381
398
|
readonly scoped: Schema.withDecodingDefaultKey<Schema.Boolean, never>;
|
|
382
399
|
readonly scopedFiles: Schema.optional<Schema.$Array<Schema.String>>;
|
|
400
|
+
readonly totalFiles: Schema.optional<Schema.Number>;
|
|
383
401
|
readonly lowCoverage: Schema.$Array<Schema.Struct<{
|
|
384
402
|
readonly file: Schema.String;
|
|
385
403
|
readonly summary: Schema.Struct<{
|
|
@@ -418,6 +436,10 @@ declare const AgentReport: Schema.Struct<{
|
|
|
418
436
|
readonly sample: Schema.optional<Schema.String>;
|
|
419
437
|
}>>;
|
|
420
438
|
readonly truncated: Schema.optional<Schema.Boolean>;
|
|
439
|
+
readonly fromFailingTests: Schema.optional<Schema.Struct<{
|
|
440
|
+
readonly total: Schema.Number;
|
|
441
|
+
readonly files: Schema.Number;
|
|
442
|
+
}>>;
|
|
421
443
|
}>>;
|
|
422
444
|
}>;
|
|
423
445
|
/** @public */
|
|
@@ -600,6 +622,9 @@ declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunStarted",
|
|
|
600
622
|
}>;
|
|
601
623
|
readonly uncoveredLines: Schema.optional<Schema.String>;
|
|
602
624
|
}>>;
|
|
625
|
+
readonly scoped: Schema.optional<Schema.Boolean>;
|
|
626
|
+
readonly scopedFiles: Schema.optional<Schema.Number>;
|
|
627
|
+
readonly totalFiles: Schema.optional<Schema.Number>;
|
|
603
628
|
}>, Schema.TaggedStruct<"ThresholdViolation", {
|
|
604
629
|
readonly metric: Schema.Literals<readonly ["lines", "branches", "functions", "statements"]>;
|
|
605
630
|
readonly expected: Schema.Number;
|
|
@@ -629,6 +654,19 @@ declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunStarted",
|
|
|
629
654
|
* tracks failing modules (report replay). See issue #204.
|
|
630
655
|
*/
|
|
631
656
|
readonly collectedModules: Schema.optional<Schema.Number>;
|
|
657
|
+
/**
|
|
658
|
+
* Process-level errors with no owning module (an unhandled
|
|
659
|
+
* rejection, a worker crash) — Vitest's `unhandledErrors`
|
|
660
|
+
* argument to `onTestRunEnd`. Optional so hand-built fixtures
|
|
661
|
+
* and older replay data keep decoding. See issue #240.
|
|
662
|
+
*/
|
|
663
|
+
readonly unhandledErrors: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
664
|
+
readonly message: Schema.String;
|
|
665
|
+
readonly stack: Schema.optional<Schema.String>;
|
|
666
|
+
readonly diff: Schema.optional<Schema.String>;
|
|
667
|
+
readonly expected: Schema.optional<Schema.String>;
|
|
668
|
+
readonly received: Schema.optional<Schema.String>;
|
|
669
|
+
}>>>;
|
|
632
670
|
}>]>;
|
|
633
671
|
/** @public */
|
|
634
672
|
type RunEvent = typeof RunEvent.Type;
|
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { DefaultVitestAgentReporter, buildDispatchInputs, renderAgentStringForRe
|
|
|
9
9
|
*
|
|
10
10
|
* @public
|
|
11
11
|
*/
|
|
12
|
-
const CURRENT_REPORTER_VERSION = "2.2.
|
|
12
|
+
const CURRENT_REPORTER_VERSION = "2.2.3";
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
15
15
|
export { CURRENT_REPORTER_VERSION, DefaultVitestAgentReporter, createLiveInk as _createLiveInk, buildDispatchInputs, renderAgentStringForReport, renderHumanStringForReport, resolveCellOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest-agent/reporter",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Named VitestAgentReporterFactory implementations for the vitest-agent ecosystem.",
|
|
6
6
|
"keywords": [
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@effect/platform-node": "4.0.0-rc.109",
|
|
43
43
|
"@effect/sql-sqlite-node": "4.0.0-rc.109",
|
|
44
|
-
"@vitest-agent/sdk": "2.
|
|
45
|
-
"@vitest-agent/ui": "2.
|
|
44
|
+
"@vitest-agent/sdk": "2.5.0",
|
|
45
|
+
"@vitest-agent/ui": "2.3.0",
|
|
46
46
|
"effect": "4.0.0-rc.109",
|
|
47
47
|
"ink": "^7.1.1",
|
|
48
48
|
"react": "^19.2.8"
|