@vitest-agent/reporter 1.0.0 → 1.0.1
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/LiveInkRenderer.js +27 -0
- package/index.js +1 -1
- package/package.json +3 -3
package/LiveInkRenderer.js
CHANGED
|
@@ -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.js
CHANGED
|
@@ -12,7 +12,7 @@ import { DefaultVitestAgentReporter, buildDispatchInputs, renderAgentStringForRe
|
|
|
12
12
|
*
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
const CURRENT_REPORTER_VERSION = "1.0.
|
|
15
|
+
const CURRENT_REPORTER_VERSION = "1.0.1";
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
18
|
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.
|
|
3
|
+
"version": "1.0.1",
|
|
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.
|
|
48
|
-
"@vitest-agent/ui": "1.0.
|
|
47
|
+
"@vitest-agent/sdk": "1.0.1",
|
|
48
|
+
"@vitest-agent/ui": "1.0.1",
|
|
49
49
|
"effect": "^3.21.4",
|
|
50
50
|
"ink": "^7.1.0",
|
|
51
51
|
"react": "^19.2.7"
|