mirror of
https://github.com/millionco/react-doctor.git
synced 2026-09-14 20:00:24 +08:00
1971506440
* feat(cli): record React-aware browser traces Add an interactive Playwright scanner that streams DevTools traces to disk and reports React rendering hotspots for humans and agents. * fix(cli): use shared telemetry anonymizer Keep runtime URL redaction on the canonical core utility after the telemetry helper consolidation. * feat(cli): visualize component renders during traces Flash labeled component outlines during runtime scans so users can connect slow interactions to the React work they trigger. * feat(skill): add runtime performance workflow Guide agents through repeatable React traces so performance findings stay tied to measured interactions. * docs(cli): guide runtime scan setup Explain the recording flow, browser isolation, authenticated sessions, output formats, and trace privacy directly in command help. * fix(cli): harden runtime trace capture Preserve evidence across navigations while keeping structured output, telemetry, trace files, and attached-browser cleanup safe under failures and cancellation. * fix(cli): preserve latest navigation evidence Keep cross-document layout shifts comparable and retain the most recent bounded performance entries so the recorded interaction remains represented. * fix(cli): bound runtime scan browser resources Prevent trace deadlocks, cross-tab capture, and unbounded browser evidence while preserving navigation data through an isolated validated relay. * fix(cli): preserve busy-page runtime snapshots Stop tracing concurrently with final probe collection and allow busy pages enough time to flush their bounded performance evidence. * feat(cli): prompt for runtime scan URL Let people start an interactive runtime scan without remembering the URL argument while keeping agents and CI deterministic. * feat(cli): suggest local apps for runtime scans Replace the bare URL field with a polished chooser that discovers common localhost development servers while preserving custom URL entry. * fix(cli): use scan terminology in runtime flow Keep the interactive copy aligned with the command users invoked instead of switching between recording and profiling language. * fix(cli): center runtime chooser in full terminal Render the interactive URL chooser as a terminal-sized view so it no longer appears anchored to the previous cursor position. * fix(cli): harden runtime scan edge cases Capture popup evidence without leaking browser pages, support redirected interactive output and IPv6 localhost apps, and keep bounded reports honest.
50 lines
1.9 KiB
TypeScript
50 lines
1.9 KiB
TypeScript
import { describe, expect, it } from "vite-plus/test";
|
|
import { activeScanAbortRegistry } from "../src/cli/utils/active-scan-abort-registry.js";
|
|
|
|
describe("activeScanAbortRegistry", () => {
|
|
it("aborts every registered scan and forgets unregistered scans", async () => {
|
|
const activeController = new AbortController();
|
|
const secondActiveController = new AbortController();
|
|
const unregisteredController = new AbortController();
|
|
const unregister = activeScanAbortRegistry.register(unregisteredController);
|
|
unregister();
|
|
activeScanAbortRegistry.register(activeController);
|
|
activeScanAbortRegistry.register(secondActiveController);
|
|
|
|
await activeScanAbortRegistry.abortAll();
|
|
|
|
expect(activeController.signal.aborted).toBe(true);
|
|
expect(secondActiveController.signal.aborted).toBe(true);
|
|
expect(unregisteredController.signal.aborted).toBe(false);
|
|
});
|
|
|
|
it("leaves controllers registered during abort callbacks active", async () => {
|
|
const activeController = new AbortController();
|
|
const registeredDuringAbortController = new AbortController();
|
|
activeController.signal.addEventListener("abort", () => {
|
|
activeScanAbortRegistry.register(registeredDuringAbortController);
|
|
});
|
|
activeScanAbortRegistry.register(activeController);
|
|
|
|
await activeScanAbortRegistry.abortAll();
|
|
|
|
expect(activeController.signal.aborted).toBe(true);
|
|
expect(registeredDuringAbortController.signal.aborted).toBe(false);
|
|
|
|
await activeScanAbortRegistry.abortAll();
|
|
expect(registeredDuringAbortController.signal.aborted).toBe(true);
|
|
});
|
|
|
|
it("waits for registered cleanup work", async () => {
|
|
let didFinishCleanup = false;
|
|
activeScanAbortRegistry.registerCleanup(async () => {
|
|
await Promise.resolve();
|
|
didFinishCleanup = true;
|
|
});
|
|
|
|
await activeScanAbortRegistry.abortAll();
|
|
|
|
expect(didFinishCleanup).toBe(true);
|
|
});
|
|
});
|