@vitest-agent/reporter 2.2.2 → 2.2.4

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.
@@ -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;
@@ -866,7 +904,7 @@ type VitestAgentReporterFactory = (kit: ReporterKit) => VitestAgentReporter | Re
866
904
  *
867
905
  * @public
868
906
  */
869
- declare const buildDispatchInputs: (state: RenderState, input: ReporterRenderInput, overrides?: {
907
+ export declare const buildDispatchInputs: (state: RenderState, input: ReporterRenderInput, overrides?: {
870
908
  readonly shape?: RunShape;
871
909
  readonly outcome?: RunOutcome;
872
910
  readonly runCommand?: string | null;
@@ -877,7 +915,7 @@ declare const buildDispatchInputs: (state: RenderState, input: ReporterRenderInp
877
915
  *
878
916
  * @public
879
917
  */
880
- declare const resolveCellOptions: (kit: ReporterKit) => CellOptions;
918
+ export declare const resolveCellOptions: (kit: ReporterKit) => CellOptions;
881
919
  /**
882
920
  * Convenience helper for one-shot consumers (e.g. a CLI command
883
921
  * replaying a stored run). Synthesizes a minimal `ReporterRenderInput`
@@ -887,7 +925,7 @@ declare const resolveCellOptions: (kit: ReporterKit) => CellOptions;
887
925
  *
888
926
  * @public
889
927
  */
890
- declare const renderAgentStringForReport: (report: AgentReport) => string;
928
+ export declare const renderAgentStringForReport: (report: AgentReport) => string;
891
929
  /**
892
930
  * Same as {@link renderAgentStringForReport} but returns the Ink-half
893
931
  * rendered to a string via Ink's `renderToString`. ANSI escape
@@ -897,7 +935,7 @@ declare const renderAgentStringForReport: (report: AgentReport) => string;
897
935
  *
898
936
  * @public
899
937
  */
900
- declare const renderHumanStringForReport: (report: AgentReport, options?: {
938
+ export declare const renderHumanStringForReport: (report: AgentReport, options?: {
901
939
  readonly width?: number;
902
940
  }) => Promise<string>;
903
941
  /**
@@ -920,7 +958,7 @@ declare const renderHumanStringForReport: (report: AgentReport, options?: {
920
958
  *
921
959
  * @public
922
960
  */
923
- declare const DefaultVitestAgentReporter: VitestAgentReporterFactory;
961
+ export declare const DefaultVitestAgentReporter: VitestAgentReporterFactory;
924
962
  //#endregion
925
963
  //#region src/LiveInkRenderer.d.ts
926
964
  /**
@@ -980,7 +1018,7 @@ declare const createLiveInk: (options?: CreateLiveInkOptions) => LiveInkRenderer
980
1018
  *
981
1019
  * @public
982
1020
  */
983
- declare const CURRENT_REPORTER_VERSION: string;
1021
+ export declare const CURRENT_REPORTER_VERSION: string;
984
1022
  //#endregion
985
- export { type AgentReport, CURRENT_REPORTER_VERSION, type CellOptions, type ConsoleMode, type CreateLiveInkOptions, DefaultVitestAgentReporter, type DetailLevel, type DispatchInputs, type Environment, type Executor, type FileCoverageReport, type LiveInkRenderer, type OutputFormat, type ProjectSummary, type RenderState, type RenderedOutput, type ReporterKit, type ReporterRenderInput, type ResolvedReporterConfig, type ResolvedThresholds, type RunEvent, type RunOutcome, type RunShape, type TestClassification, type Transport, type TrendSummary, type VitestAgentReporter, type VitestAgentReporterFactory, createLiveInk as _createLiveInk, buildDispatchInputs, renderAgentStringForReport, renderHumanStringForReport, resolveCellOptions };
1023
+ export { type AgentReport, type CellOptions, type ConsoleMode, type CreateLiveInkOptions, type DetailLevel, type DispatchInputs, type Environment, type Executor, type FileCoverageReport, type LiveInkRenderer, type OutputFormat, type ProjectSummary, type RenderState, type RenderedOutput, type ReporterKit, type ReporterRenderInput, type ResolvedReporterConfig, type ResolvedThresholds, type RunEvent, type RunOutcome, type RunShape, type TestClassification, type Transport, type TrendSummary, type VitestAgentReporter, type VitestAgentReporterFactory, createLiveInk as _createLiveInk };
986
1024
  //# sourceMappingURL=index.d.ts.map
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.2";
12
+ const CURRENT_REPORTER_VERSION = "2.2.4";
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.2",
3
+ "version": "2.2.4",
4
4
  "private": false,
5
5
  "description": "Named VitestAgentReporterFactory implementations for the vitest-agent ecosystem.",
6
6
  "keywords": [
@@ -39,11 +39,11 @@
39
39
  "./package.json": "./package.json"
40
40
  },
41
41
  "dependencies": {
42
- "@effect/platform-node": "4.0.0-rc.109",
43
- "@effect/sql-sqlite-node": "4.0.0-rc.109",
44
- "@vitest-agent/sdk": "2.4.13",
45
- "@vitest-agent/ui": "2.2.13",
46
- "effect": "4.0.0-rc.109",
42
+ "@effect/platform-node": "4.0.0-rc.112",
43
+ "@effect/sql-sqlite-node": "4.0.0-rc.112",
44
+ "@vitest-agent/sdk": "2.5.1",
45
+ "@vitest-agent/ui": "2.3.1",
46
+ "effect": "4.0.0-rc.112",
47
47
  "ink": "^7.1.1",
48
48
  "react": "^19.2.8"
49
49
  },