@vitest-agent/reporter 1.0.0 → 1.0.2

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.
@@ -5,6 +5,31 @@ import { createElement } from "react";
5
5
 
6
6
  //#region src/LiveInkRenderer.tsx
7
7
  /**
8
+ * Drain the global user-timing buffer after a render.
9
+ *
10
+ * React 19's *development* reconciler — the build Ink loads whenever
11
+ * `NODE_ENV !== "production"`, which is the norm under Vitest — emits a
12
+ * `performance.measure()` into the global user-timing buffer on every
13
+ * component render for its "Component Performance Track" DevTools feature.
14
+ * Nothing in a Node process consumes that buffer, so across a long run the
15
+ * live mount's per-event and per-spinner-tick rerenders pile up millions of
16
+ * `measure` entries until Node prints `MaxPerformanceEntryBufferExceededWarning`
17
+ * (issue #97). The renderer owns every render call, so it drains the buffer
18
+ * right after each one, bounding it to a single render's worth of entries.
19
+ *
20
+ * Clearing the whole measure/mark buffer is safe here: this runs in the
21
+ * Vitest main process, where test code executes in forked workers (separate
22
+ * perf buffers) and nothing downstream reads these entries. Guarded against
23
+ * runtimes that lack the user-timing API and never allowed to throw — buffer
24
+ * hygiene must not derail a run.
25
+ */
26
+ const drainRenderPerfEntries = () => {
27
+ try {
28
+ performance.clearMeasures?.();
29
+ performance.clearMarks?.();
30
+ } catch {}
31
+ };
32
+ /**
8
33
  * Create a {@link LiveInkRenderer} that drives a live Ink mount for
9
34
  * `consoleMode: "stream"`. Call `event(e)` for each `RunEvent` published
10
35
  * by the plugin; the renderer mounts on `RunStarted`, rerenders on each
@@ -49,6 +74,7 @@ const createLiveInk = (options = {}) => {
49
74
  if (instance === null) return;
50
75
  try {
51
76
  instance.rerender(frameElement());
77
+ drainRenderPerfEntries();
52
78
  } catch {
53
79
  instance = null;
54
80
  stopClock();
@@ -105,6 +131,7 @@ const createLiveInk = (options = {}) => {
105
131
  }
106
132
  firstRunStarted = false;
107
133
  }
134
+ drainRenderPerfEntries();
108
135
  },
109
136
  unmount() {
110
137
  tearDown();
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PubSub, Schema } from "effect";
2
- //#region ../sdk/dist/dev/pkg/DataReader-2kJ9I9Hh.d.ts
2
+ //#region ../sdk/dist/dev/pkg/index.d.ts
3
3
  /**
4
4
  * Per-file coverage data including uncovered line ranges.
5
5
  * @public
@@ -20,156 +20,6 @@ type FileCoverageReport = typeof FileCoverageReport.Type;
20
20
  * Complete coverage report attached to an AgentReport.
21
21
  * @public
22
22
  */
23
- /**
24
- * Complete per-project test report written to disk as JSON.
25
- * @public
26
- */
27
- declare const AgentReport: Schema.Struct<{
28
- timestamp: typeof Schema.String;
29
- project: Schema.optional<typeof Schema.String>;
30
- reason: Schema.Literal<["passed", "failed", "interrupted"]>;
31
- summary: Schema.Struct<{
32
- total: typeof Schema.Number;
33
- passed: typeof Schema.Number;
34
- failed: typeof Schema.Number;
35
- skipped: typeof Schema.Number;
36
- duration: typeof Schema.Number;
37
- }>;
38
- failed: Schema.Array$<Schema.Struct<{
39
- file: typeof Schema.String;
40
- state: Schema.Literal<["passed", "failed", "skipped", "pending"]>;
41
- duration: Schema.optional<typeof Schema.Number>;
42
- errors: Schema.optional<Schema.Array$<Schema.Struct<{
43
- message: typeof Schema.String;
44
- stack: Schema.optional<typeof Schema.String>;
45
- diff: Schema.optional<typeof Schema.String>;
46
- expected: Schema.optional<typeof Schema.String>;
47
- received: Schema.optional<typeof Schema.String>;
48
- }>>>;
49
- tests: Schema.Array$<Schema.Struct<{
50
- name: typeof Schema.String;
51
- fullName: typeof Schema.String;
52
- state: Schema.Literal<["passed", "failed", "skipped", "pending"]>;
53
- duration: Schema.optional<typeof Schema.Number>;
54
- flaky: Schema.optional<typeof Schema.Boolean>;
55
- slow: Schema.optional<typeof Schema.Boolean>;
56
- errors: Schema.optional<Schema.Array$<Schema.Struct<{
57
- message: typeof Schema.String;
58
- stack: Schema.optional<typeof Schema.String>;
59
- diff: Schema.optional<typeof Schema.String>;
60
- expected: Schema.optional<typeof Schema.String>;
61
- received: Schema.optional<typeof Schema.String>;
62
- }>>>;
63
- classification: Schema.optional<Schema.Literal<["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
64
- }>>;
65
- }>>;
66
- unhandledErrors: Schema.Array$<Schema.Struct<{
67
- message: typeof Schema.String;
68
- stack: Schema.optional<typeof Schema.String>;
69
- diff: Schema.optional<typeof Schema.String>;
70
- expected: Schema.optional<typeof Schema.String>;
71
- received: Schema.optional<typeof Schema.String>;
72
- }>>;
73
- failedFiles: Schema.Array$<typeof Schema.String>;
74
- coverage: Schema.optional<Schema.Struct<{
75
- totals: Schema.Struct<{
76
- statements: typeof Schema.Number;
77
- branches: typeof Schema.Number;
78
- functions: typeof Schema.Number;
79
- lines: typeof Schema.Number;
80
- }>;
81
- thresholds: Schema.Struct<{
82
- global: Schema.Struct<{
83
- lines: Schema.optional<typeof Schema.Number>;
84
- functions: Schema.optional<typeof Schema.Number>;
85
- branches: Schema.optional<typeof Schema.Number>;
86
- statements: Schema.optional<typeof Schema.Number>;
87
- }>;
88
- patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
89
- lines: Schema.optional<typeof Schema.Number>;
90
- functions: Schema.optional<typeof Schema.Number>;
91
- branches: Schema.optional<typeof Schema.Number>;
92
- statements: Schema.optional<typeof Schema.Number>;
93
- }>>>, {
94
- default: () => never[];
95
- }>;
96
- }>;
97
- targets: Schema.optional<Schema.Struct<{
98
- global: Schema.Struct<{
99
- lines: Schema.optional<typeof Schema.Number>;
100
- functions: Schema.optional<typeof Schema.Number>;
101
- branches: Schema.optional<typeof Schema.Number>;
102
- statements: Schema.optional<typeof Schema.Number>;
103
- }>;
104
- patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
105
- lines: Schema.optional<typeof Schema.Number>;
106
- functions: Schema.optional<typeof Schema.Number>;
107
- branches: Schema.optional<typeof Schema.Number>;
108
- statements: Schema.optional<typeof Schema.Number>;
109
- }>>>, {
110
- default: () => never[];
111
- }>;
112
- }>>;
113
- baselines: Schema.optional<Schema.Struct<{
114
- global: Schema.Struct<{
115
- lines: Schema.optional<typeof Schema.Number>;
116
- functions: Schema.optional<typeof Schema.Number>;
117
- branches: Schema.optional<typeof Schema.Number>;
118
- statements: Schema.optional<typeof Schema.Number>;
119
- }>;
120
- patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
121
- lines: Schema.optional<typeof Schema.Number>;
122
- functions: Schema.optional<typeof Schema.Number>;
123
- branches: Schema.optional<typeof Schema.Number>;
124
- statements: Schema.optional<typeof Schema.Number>;
125
- }>>>, {
126
- default: () => never[];
127
- }>;
128
- }>>;
129
- scoped: Schema.optionalWith<typeof Schema.Boolean, {
130
- default: () => false;
131
- }>;
132
- scopedFiles: Schema.optional<Schema.Array$<typeof Schema.String>>;
133
- lowCoverage: Schema.Array$<Schema.Struct<{
134
- file: typeof Schema.String;
135
- summary: Schema.Struct<{
136
- statements: typeof Schema.Number;
137
- branches: typeof Schema.Number;
138
- functions: typeof Schema.Number;
139
- lines: typeof Schema.Number;
140
- }>;
141
- uncoveredLines: typeof Schema.String;
142
- }>>;
143
- lowCoverageFiles: Schema.Array$<typeof Schema.String>;
144
- belowTarget: Schema.optional<Schema.Array$<Schema.Struct<{
145
- file: typeof Schema.String;
146
- summary: Schema.Struct<{
147
- statements: typeof Schema.Number;
148
- branches: typeof Schema.Number;
149
- functions: typeof Schema.Number;
150
- lines: typeof Schema.Number;
151
- }>;
152
- uncoveredLines: typeof Schema.String;
153
- }>>>;
154
- belowTargetFiles: Schema.optional<Schema.Array$<typeof Schema.String>>;
155
- }>>;
156
- tagCounts: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Struct<{
157
- passed: Schema.optional<typeof Schema.Number>;
158
- failed: Schema.optional<typeof Schema.Number>;
159
- skipped: Schema.optional<typeof Schema.Number>;
160
- }>>>;
161
- }>;
162
- /** @public */
163
- type AgentReport = typeof AgentReport.Type; //#endregion
164
- //#region src/schemas/Identity.d.ts
165
- /**
166
- * Canonical UUID for an LLM agent invocation. Generated server-side at
167
- * `register_agent` time. Stable across transport reconnects within an
168
- * agent's lifetime.
169
- * @public
170
- */
171
- //#endregion
172
- //#region ../sdk/dist/dev/pkg/index.d.ts
173
23
  /**
174
24
  * The renderer state. Both the human (Ink) and agent (string)
175
25
  * renderers read this shape; the reducer is the only producer.
@@ -415,6 +265,163 @@ interface CellOptions {
415
265
  */
416
266
  readonly osc8: (url: string, label: string) => string;
417
267
  } //#endregion
268
+ //#region src/schemas/AgentReport.d.ts
269
+ /**
270
+ * Aggregate test run statistics.
271
+ * @public
272
+ */
273
+ /**
274
+ * Complete per-project test report written to disk as JSON.
275
+ * @public
276
+ */
277
+ declare const AgentReport: Schema.Struct<{
278
+ timestamp: typeof Schema.String;
279
+ project: Schema.optional<typeof Schema.String>;
280
+ reason: Schema.Literal<["passed", "failed", "interrupted"]>;
281
+ summary: Schema.Struct<{
282
+ total: typeof Schema.Number;
283
+ passed: typeof Schema.Number;
284
+ failed: typeof Schema.Number;
285
+ skipped: typeof Schema.Number;
286
+ duration: typeof Schema.Number;
287
+ }>;
288
+ failed: Schema.Array$<Schema.Struct<{
289
+ file: typeof Schema.String;
290
+ state: Schema.Literal<["passed", "failed", "skipped", "pending"]>;
291
+ duration: Schema.optional<typeof Schema.Number>;
292
+ errors: Schema.optional<Schema.Array$<Schema.Struct<{
293
+ message: typeof Schema.String;
294
+ stack: Schema.optional<typeof Schema.String>;
295
+ diff: Schema.optional<typeof Schema.String>;
296
+ expected: Schema.optional<typeof Schema.String>;
297
+ received: Schema.optional<typeof Schema.String>;
298
+ }>>>;
299
+ tests: Schema.Array$<Schema.Struct<{
300
+ name: typeof Schema.String;
301
+ fullName: typeof Schema.String;
302
+ state: Schema.Literal<["passed", "failed", "skipped", "pending"]>;
303
+ duration: Schema.optional<typeof Schema.Number>;
304
+ flaky: Schema.optional<typeof Schema.Boolean>;
305
+ slow: Schema.optional<typeof Schema.Boolean>;
306
+ errors: Schema.optional<Schema.Array$<Schema.Struct<{
307
+ message: typeof Schema.String;
308
+ stack: Schema.optional<typeof Schema.String>;
309
+ diff: Schema.optional<typeof Schema.String>;
310
+ expected: Schema.optional<typeof Schema.String>;
311
+ received: Schema.optional<typeof Schema.String>;
312
+ }>>>;
313
+ classification: Schema.optional<Schema.Literal<["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
314
+ }>>;
315
+ }>>;
316
+ unhandledErrors: Schema.Array$<Schema.Struct<{
317
+ message: typeof Schema.String;
318
+ stack: Schema.optional<typeof Schema.String>;
319
+ diff: Schema.optional<typeof Schema.String>;
320
+ expected: Schema.optional<typeof Schema.String>;
321
+ received: Schema.optional<typeof Schema.String>;
322
+ }>>;
323
+ failedFiles: Schema.Array$<typeof Schema.String>;
324
+ coverage: Schema.optional<Schema.Struct<{
325
+ totals: Schema.Struct<{
326
+ statements: typeof Schema.Number;
327
+ branches: typeof Schema.Number;
328
+ functions: typeof Schema.Number;
329
+ lines: typeof Schema.Number;
330
+ }>;
331
+ thresholds: Schema.Struct<{
332
+ global: Schema.Struct<{
333
+ lines: Schema.optional<typeof Schema.Number>;
334
+ functions: Schema.optional<typeof Schema.Number>;
335
+ branches: Schema.optional<typeof Schema.Number>;
336
+ statements: Schema.optional<typeof Schema.Number>;
337
+ }>;
338
+ patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
339
+ lines: Schema.optional<typeof Schema.Number>;
340
+ functions: Schema.optional<typeof Schema.Number>;
341
+ branches: Schema.optional<typeof Schema.Number>;
342
+ statements: Schema.optional<typeof Schema.Number>;
343
+ }>>>, {
344
+ default: () => never[];
345
+ }>;
346
+ }>;
347
+ targets: Schema.optional<Schema.Struct<{
348
+ global: Schema.Struct<{
349
+ lines: Schema.optional<typeof Schema.Number>;
350
+ functions: Schema.optional<typeof Schema.Number>;
351
+ branches: Schema.optional<typeof Schema.Number>;
352
+ statements: Schema.optional<typeof Schema.Number>;
353
+ }>;
354
+ patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
355
+ lines: Schema.optional<typeof Schema.Number>;
356
+ functions: Schema.optional<typeof Schema.Number>;
357
+ branches: Schema.optional<typeof Schema.Number>;
358
+ statements: Schema.optional<typeof Schema.Number>;
359
+ }>>>, {
360
+ default: () => never[];
361
+ }>;
362
+ }>>;
363
+ baselines: Schema.optional<Schema.Struct<{
364
+ global: Schema.Struct<{
365
+ lines: Schema.optional<typeof Schema.Number>;
366
+ functions: Schema.optional<typeof Schema.Number>;
367
+ branches: Schema.optional<typeof Schema.Number>;
368
+ statements: Schema.optional<typeof Schema.Number>;
369
+ }>;
370
+ patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
371
+ lines: Schema.optional<typeof Schema.Number>;
372
+ functions: Schema.optional<typeof Schema.Number>;
373
+ branches: Schema.optional<typeof Schema.Number>;
374
+ statements: Schema.optional<typeof Schema.Number>;
375
+ }>>>, {
376
+ default: () => never[];
377
+ }>;
378
+ }>>;
379
+ scoped: Schema.optionalWith<typeof Schema.Boolean, {
380
+ default: () => false;
381
+ }>;
382
+ scopedFiles: Schema.optional<Schema.Array$<typeof Schema.String>>;
383
+ lowCoverage: Schema.Array$<Schema.Struct<{
384
+ file: typeof Schema.String;
385
+ summary: Schema.Struct<{
386
+ statements: typeof Schema.Number;
387
+ branches: typeof Schema.Number;
388
+ functions: typeof Schema.Number;
389
+ lines: typeof Schema.Number;
390
+ }>;
391
+ uncoveredLines: typeof Schema.String;
392
+ }>>;
393
+ lowCoverageFiles: Schema.Array$<typeof Schema.String>;
394
+ belowTarget: Schema.optional<Schema.Array$<Schema.Struct<{
395
+ file: typeof Schema.String;
396
+ summary: Schema.Struct<{
397
+ statements: typeof Schema.Number;
398
+ branches: typeof Schema.Number;
399
+ functions: typeof Schema.Number;
400
+ lines: typeof Schema.Number;
401
+ }>;
402
+ uncoveredLines: typeof Schema.String;
403
+ }>>>;
404
+ belowTargetFiles: Schema.optional<Schema.Array$<typeof Schema.String>>;
405
+ }>>;
406
+ tagCounts: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Struct<{
407
+ passed: Schema.optional<typeof Schema.Number>;
408
+ failed: Schema.optional<typeof Schema.Number>;
409
+ skipped: Schema.optional<typeof Schema.Number>;
410
+ }>>>;
411
+ consoleLeaks: Schema.optional<Schema.Struct<{
412
+ total: typeof Schema.Number;
413
+ byFile: Schema.Array$<Schema.Struct<{
414
+ file: typeof Schema.String;
415
+ stdout: typeof Schema.Number;
416
+ stderr: typeof Schema.Number;
417
+ tests: Schema.optional<Schema.Array$<typeof Schema.String>>;
418
+ sample: Schema.optional<typeof Schema.String>;
419
+ }>>;
420
+ truncated: Schema.optional<typeof Schema.Boolean>;
421
+ }>>;
422
+ }>;
423
+ /** @public */
424
+ type AgentReport = typeof AgentReport.Type; //#endregion
418
425
  //#region src/schemas/Common.d.ts
419
426
  /**
420
427
  * Possible states for an individual test case.
@@ -875,7 +882,13 @@ interface VitestAgentReporter {
875
882
  * @public
876
883
  */
877
884
  type VitestAgentReporterFactory = (kit: ReporterKit) => VitestAgentReporter | ReadonlyArray<VitestAgentReporter>; //#endregion
878
- //#region src/errors/DiscoveryError.d.ts
885
+ //#region src/schemas/Identity.d.ts
886
+ /**
887
+ * Canonical UUID for an LLM agent invocation. Generated server-side at
888
+ * `register_agent` time. Stable across transport reconnects within an
889
+ * agent's lifetime.
890
+ * @public
891
+ */
879
892
  //#endregion
880
893
  //#region src/defaultReporter.d.ts
881
894
  /**
@@ -997,10 +1010,7 @@ declare const createLiveInk: (options?: CreateLiveInkOptions) => LiveInkRenderer
997
1010
  /**
998
1011
  * The version of this package, inlined at build time from
999
1012
  * package.json#version via rslib-builder's __PACKAGE_VERSION__ substitution.
1000
- * The reporter is consumed through the plugin so it does not run its own
1001
- * init-time drift check, but the constant is exported so the plugin can
1002
- * compare against it. See the root CLAUDE.md "Cross-package version drift"
1003
- * section.
1013
+ * Exported for version introspection by downstream tooling.
1004
1014
  *
1005
1015
  * @public
1006
1016
  */
package/index.js CHANGED
@@ -5,14 +5,11 @@ import { DefaultVitestAgentReporter, buildDispatchInputs, renderAgentStringForRe
5
5
  /**
6
6
  * The version of this package, inlined at build time from
7
7
  * package.json#version via rslib-builder's __PACKAGE_VERSION__ substitution.
8
- * The reporter is consumed through the plugin so it does not run its own
9
- * init-time drift check, but the constant is exported so the plugin can
10
- * compare against it. See the root CLAUDE.md "Cross-package version drift"
11
- * section.
8
+ * Exported for version introspection by downstream tooling.
12
9
  *
13
10
  * @public
14
11
  */
15
- const CURRENT_REPORTER_VERSION = "1.0.0";
12
+ const CURRENT_REPORTER_VERSION = "1.0.2";
16
13
 
17
14
  //#endregion
18
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": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "private": false,
5
5
  "description": "Named VitestAgentReporterFactory implementations for the vitest-agent ecosystem.",
6
6
  "keywords": [
@@ -44,8 +44,8 @@
44
44
  "@effect/rpc": "^0.75.1",
45
45
  "@effect/sql": "^0.51.1",
46
46
  "@effect/sql-sqlite-node": "^0.52.0",
47
- "@vitest-agent/sdk": "1.0.0",
48
- "@vitest-agent/ui": "1.0.0",
47
+ "@vitest-agent/sdk": "1.1.0",
48
+ "@vitest-agent/ui": "1.0.2",
49
49
  "effect": "^3.21.4",
50
50
  "ink": "^7.1.0",
51
51
  "react": "^19.2.7"