From 1b4497ce947c9183f89da28c98c94631008505b5 Mon Sep 17 00:00:00 2001 From: Andre Brait Date: Sat, 12 Sep 2026 12:18:36 +0000 Subject: [PATCH 1/2] test: replace deprecated React test renderer --- CONTRIBUTING.md | 13 + components/ChatInput.navigation.test.mjs | 117 ++++----- hooks/useAgentSession.rpc.test.mjs | 291 +++++++++-------------- hooks/useSidebarHistory.test.mjs | 186 ++++++++------- hooks/useTheme.test.mjs | 164 ++++++------- package.json | 5 +- tests/setup-dom.mjs | 38 +++ 7 files changed, 390 insertions(+), 424 deletions(-) create mode 100644 tests/setup-dom.mjs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b4bb4168b..3db4f05a5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,6 +23,19 @@ npm test # unit tests Avoid `npm run build` during local development — it writes to `.next/` and interferes with the dev server. Builds are for release work. +### React tests + +Tests use `node:test` and `jiti`; no Jest or Vitest configuration is required. +For interactive components and hooks, import `tests/setup-dom.mjs` before +`@testing-library/react/pure.js`, and register `cleanup` with `afterEach`. +Use DOM queries and `@testing-library/user-event` for component interactions, +and `renderHook` for hook state and lifecycle tests. Keep the real jsdom +`window` and `document`; mock only the browser or network APIs a scenario needs. + +Static HTML tests can continue using `react-dom/server`. Layout, scrolling, +and native browser navigation still require real-browser verification. +The jsdom dependency stays on 29.x to support the Node 22.19.0 baseline. + ## Conventions - **Styling**: use the design tokens in `app/globals.css` (colors, radius, diff --git a/components/ChatInput.navigation.test.mjs b/components/ChatInput.navigation.test.mjs index c98324939..2f3da6827 100644 --- a/components/ChatInput.navigation.test.mjs +++ b/components/ChatInput.navigation.test.mjs @@ -1,33 +1,32 @@ +import "../tests/setup-dom.mjs"; import assert from "node:assert/strict"; -import test from "node:test"; +import test, { afterEach, beforeEach } from "node:test"; import React, { act } from "react"; -import TestRenderer from "react-test-renderer"; +import { cleanup, render, screen, waitFor } from "@testing-library/react/pure.js"; +import userEvent from "@testing-library/user-event"; import { createJiti } from "jiti"; const jiti = createJiti(import.meta.url, { jsx: { runtime: "automatic" }, tsconfigPaths: true }); const { ChatInput } = await jiti.import("./ChatInput.tsx"); const { useSidebarHistory } = await jiti.import("@/hooks/useSidebarHistory"); const { clearDraft, getDraft } = await jiti.import("@/lib/draft-store"); -globalThis.IS_REACT_ACT_ENVIRONMENT = true; -function installBrowser() { - const listeners = new Map(); - globalThis.window = { - matchMedia: () => ({ matches: false, addEventListener() {}, removeEventListener() {} }), - addEventListener(type, fn) { - if (!listeners.has(type)) listeners.set(type, new Set()); - listeners.get(type).add(fn); - }, - removeEventListener(type, fn) { listeners.get(type)?.delete(fn); }, - }; - globalThis.document = { documentElement: {}, addEventListener() {}, removeEventListener() {} }; - globalThis.localStorage = { getItem: () => null }; - globalThis.requestAnimationFrame = () => 0; - return () => { - const event = { defaultPrevented: false, preventDefault() { this.defaultPrevented = true; } }; - for (const fn of listeners.get("beforeunload") ?? []) fn(event); - return event.defaultPrevented; - }; +beforeEach(() => { + window.matchMedia = () => ({ matches: false, addEventListener() {}, removeEventListener() {} }); +}); +afterEach(() => { + cleanup(); + clearDraft("new:unassigned"); + clearDraft("draft-a"); + clearDraft("draft-b"); + localStorage.clear(); + delete window.matchMedia; +}); + +function warnsOnExit() { + const event = new Event("beforeunload", { cancelable: true }); + window.dispatchEvent(event); + return event.defaultPrevented; } function Guard() { @@ -37,41 +36,32 @@ function Guard() { return null; } -const enter = { key: "Enter", nativeEvent: {}, preventDefault() {}, shiftKey: false }; - test("no-key composer text survives minimization and warns on document exit until sent", async () => { - const warnsOnExit = installBrowser(); - const ref = React.createRef(); + const user = userEvent.setup(); const sent = []; function Shell({ minimized = false }) { return React.createElement(React.Fragment, null, React.createElement(Guard), React.createElement("div", { style: { display: minimized ? "none" : undefined } }, - React.createElement(ChatInput, { ref, onSend: (text) => sent.push(text), onAbort() {}, isStreaming: false })), + React.createElement(ChatInput, { onSend: (text) => sent.push(text), onAbort() {}, isStreaming: false })), ); } - let renderer; - try { - await act(() => { renderer = TestRenderer.create(React.createElement(Shell)); }); - assert.equal(warnsOnExit(), false); - await act(() => ref.current.insertText("unsent in a new composer")); - assert.equal(warnsOnExit(), true); - await act(() => renderer.update(React.createElement(Shell, { minimized: true }))); - assert.equal(warnsOnExit(), true); - assert.equal(renderer.root.findByType("textarea").props.value, "unsent in a new composer"); - await act(() => renderer.root.findByType("textarea").props.onKeyDown(enter)); - assert.deepEqual(sent, ["unsent in a new composer"]); - assert.equal(warnsOnExit(), false); - } finally { - await act(() => renderer?.unmount()); - clearDraft("new:unassigned"); - delete globalThis.window; - delete globalThis.document; - } + const { rerender } = render(React.createElement(Shell)); + assert.equal(warnsOnExit(), false); + await user.type(screen.getByRole("textbox"), "unsent in a new composer"); + assert.equal(warnsOnExit(), true); + rerender(React.createElement(Shell, { minimized: true })); + assert.equal(warnsOnExit(), true); + assert.equal(screen.getByRole("textbox", { hidden: true }).value, "unsent in a new composer"); + rerender(React.createElement(Shell)); + await user.click(screen.getByRole("textbox")); + await user.keyboard("{Enter}"); + assert.deepEqual(sent, ["unsent in a new composer"]); + assert.equal(warnsOnExit(), false); }); test("attachment-only drafts stay protected across live draft-key changes and restore without warning on internal picks", async () => { - const warnsOnExit = installBrowser(); + const user = userEvent.setup(); const ref = React.createRef(); const sent = []; function Shell({ session }) { @@ -80,26 +70,19 @@ test("attachment-only drafts stay protected across live draft-key changes and re React.createElement(ChatInput, { draftKey: session, ref, onSend: (text) => sent.push(text), onAbort() {}, isStreaming: false }), ); } - let renderer; - try { - await act(() => { renderer = TestRenderer.create(React.createElement(Shell, { session: "draft-a" })); }); - await act(async () => { - ref.current.addFiles([new File(["important attachment"], "notes.txt", { type: "text/plain" })]); - }); - assert.equal(warnsOnExit(), true); - await act(() => renderer.update(React.createElement(Shell, { session: "draft-b" }))); - assert.equal(renderer.root.findByType("textarea").props.value, ""); - assert.equal(getDraft("draft-a")?.files[0]?.content, "important attachment"); - assert.equal(warnsOnExit(), true); - await act(() => renderer.update(React.createElement(Shell, { session: "draft-a" }))); - await act(() => renderer.root.findByType("textarea").props.onKeyDown(enter)); - assert.match(sent[0], /important attachment/); - assert.equal(warnsOnExit(), false); - } finally { - await act(() => renderer?.unmount()); - clearDraft("draft-a"); - clearDraft("draft-b"); - delete globalThis.window; - delete globalThis.document; - } + const { rerender } = render(React.createElement(Shell, { session: "draft-a" })); + await act(async () => { + ref.current.addFiles([new File(["important attachment"], "notes.txt", { type: "text/plain" })]); + }); + await waitFor(() => assert.equal(getDraft("draft-a")?.files[0]?.content, "important attachment")); + assert.equal(warnsOnExit(), true); + rerender(React.createElement(Shell, { session: "draft-b" })); + assert.equal(screen.getByRole("textbox").value, ""); + assert.equal(getDraft("draft-a")?.files[0]?.content, "important attachment"); + assert.equal(warnsOnExit(), true); + rerender(React.createElement(Shell, { session: "draft-a" })); + await user.click(screen.getByRole("textbox")); + await user.keyboard("{Enter}"); + assert.match(sent[0], /important attachment/); + assert.equal(warnsOnExit(), false); }); diff --git a/hooks/useAgentSession.rpc.test.mjs b/hooks/useAgentSession.rpc.test.mjs index 5809e9c29..00eac8d31 100644 --- a/hooks/useAgentSession.rpc.test.mjs +++ b/hooks/useAgentSession.rpc.test.mjs @@ -1,79 +1,15 @@ +import "../tests/setup-dom.mjs"; import assert from "node:assert/strict"; -import test from "node:test"; -import { createRequire } from "node:module"; +import test, { afterEach, beforeEach } from "node:test"; import { fileURLToPath } from "node:url"; import { createJiti } from "jiti"; +import { act, cleanup, renderHook } from "@testing-library/react/pure.js"; // useAgentSession is the chat state machine. These tests drive it through a -// controllable fake EventSource + fetch router mounted via react-test-renderer -// (TODO §5): connection, streaming, terminal events, late/duplicate frames, +// controllable fake EventSource + fetch router mounted via React Testing Library: +// connection, streaming, terminal events, late/duplicate frames, // reconnect, and unmount — not source-string checks. -const require = createRequire(import.meta.url); -const React = require("react"); -const { act } = React; -const TestRenderer = require("react-test-renderer"); - -// --------------------------------------------------------------------------- -// Browser-global stubs (installed once; the hook guards most DOM access). -// --------------------------------------------------------------------------- -globalThis.IS_REACT_ACT_ENVIRONMENT = true; -const kvStore = new Map(); -globalThis.localStorage = { - getItem: (k) => kvStore.get(k) ?? null, - setItem: (k, v) => kvStore.set(k, String(v)), - removeItem: (k) => kvStore.delete(k), - clear: () => kvStore.clear(), -}; -globalThis.sessionStorage = { - getItem: () => null, - setItem: () => {}, - removeItem: () => {}, -}; -// Listeners are capturable so tests can fire visibilitychange/online. -function makeEventTarget() { - const map = new Map(); - return { - addEventListener: (type, fn) => { - if (!map.has(type)) map.set(type, []); - map.get(type).push(fn); - }, - removeEventListener: (type, fn) => { - const list = map.get(type); - if (list) map.set(type, list.filter((f) => f !== fn)); - }, - fire: (type) => { - for (const fn of [...(map.get(type) ?? [])]) fn({ type }); - }, - }; -} -const docTarget = makeEventTarget(); -const winTarget = makeEventTarget(); -globalThis.document = { - // hidden: the message-update coalescer then flushes on a 50ms timer instead - // of requestAnimationFrame, which is deterministic with real timers here. - hidden: true, - visibilityState: "visible", - title: "", - ...docTarget, -}; -globalThis.window = { - ...winTarget, - open() {}, - matchMedia: () => ({ - matches: false, - addEventListener() {}, - removeEventListener() {}, - addListener() {}, - removeListener() {}, - }), -}; -Object.defineProperty(globalThis, "navigator", { - value: { onLine: true, clipboard: undefined }, - configurable: true, -}); -globalThis.requestAnimationFrame = (cb) => setTimeout(() => cb(Date.now()), 0); -globalThis.cancelAnimationFrame = (id) => clearTimeout(id); // --------------------------------------------------------------------------- // Fake EventSource + fetch router @@ -111,7 +47,6 @@ class FakeEventSource { this.readyState = FakeEventSource.CLOSED; } } -globalThis.EventSource = FakeEventSource; function safeParse(text) { try { @@ -184,7 +119,42 @@ async function fetchStub(url, init = {}) { return jsonResponse(404, {}); } -globalThis.fetch = fetchStub; +// Keep real DOM event targets and storage; only browser state and network +// boundaries need doubles. Hidden tabs use the coalescer's 50ms timer. +let visibilityState = "hidden"; +const overrides = [ + [globalThis, "EventSource", { value: FakeEventSource }], + [globalThis, "fetch", { value: fetchStub }], + [document, "hidden", { get: () => visibilityState === "hidden" }], + [document, "visibilityState", { get: () => visibilityState }], + [window, "matchMedia", { + value: (media) => Object.assign(new window.EventTarget(), { matches: false, media }), + }], +].map(([target, key, replacement]) => ({ + target, key, replacement, original: Object.getOwnPropertyDescriptor(target, key), +})); + +beforeEach(() => { + visibilityState = "hidden"; + localStorage.clear(); + sessionStorage.clear(); + for (const { target, key, replacement } of overrides) { + Object.defineProperty(target, key, { configurable: true, ...replacement }); + } +}); + +afterEach(() => { + try { + cleanup(); + } finally { + for (const { target, key, original } of overrides) { + if (original) Object.defineProperty(target, key, original); + else delete target[key]; + } + localStorage.clear(); + sessionStorage.clear(); + } +}); // The hook chain includes components/ui/toast.tsx, whose JSX jiti cannot parse // in this environment and whose DOM toasts must never fire inside Node tests. @@ -222,37 +192,18 @@ function sessionInfo(sid) { } async function mountSession(sid, onAgentEnd) { - let latest = null; - function Chat({ session }) { - latest = useAgentSession({ session, newSessionCwd: null, ...(onAgentEnd ? { onAgentEnd } : {}) }); - return null; - } - let renderer; - await act(async () => { - renderer = TestRenderer.create(React.createElement(Chat, { session: sessionInfo(sid) })); - }); + const session = sessionInfo(sid); + const { result, unmount } = renderHook(() => useAgentSession({ + session, newSessionCwd: null, ...(onAgentEnd ? { onAgentEnd } : {}), + })); await settle(); // hydration: loadSession + /state + models + subagents - activeRenderers.add(renderer); return { - renderer, + unmount, get latest() { - return latest; + return result.current; }, }; } -// Unmounted renderers must not leak intervals/timers that keep the test -// process alive. -const activeRenderers = new Set(); -function unmountAll() { - for (const r of [...activeRenderers]) { - try { - act(() => r.unmount()); - } catch { - // already unmounted - } - } - activeRenderers.clear(); -} function lastEs() { return world.esInstances[world.esInstances.length - 1]; @@ -290,9 +241,8 @@ const assistantMsg = (id, text) => ({ }); /** Mount + hydrate, then send a prompt and open the stream. Returns the ES. */ -async function startRun(t, sid, message) { +async function startRun(sid, message) { const w = await mountSession(sid); - if (t) t.after(unmountAll); assert.equal(w.latest.loading, false, "hydration must complete"); assert.equal(w.latest.agentRunning, false); @@ -310,18 +260,17 @@ async function startRun(t, sid, message) { }); assert.equal(w.latest.agentRunning, true, "optimistic running state"); assert.equal(callsTo("POST", "/api/agent/").some((c) => c.body?.type === "prompt" && c.body?.message === message), true, "prompt command must be sent"); - return { w, es, renderer: w.renderer }; + return { w, es }; } // --------------------------------------------------------------------------- // Tests // --------------------------------------------------------------------------- -test("full run over fake SSE: optimistic bubble, coalesced streaming, terminal reload", async (t) => { - t.after(unmountAll); +test("full run over fake SSE: optimistic bubble, coalesced streaming, terminal reload", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "loaded question")]); - const { w, es } = await startRun(t, "s1", "hello agent"); + const { w, es } = await startRun("s1", "hello agent"); // Run starts. await act(async () => { @@ -377,11 +326,10 @@ test("full run over fake SSE: optimistic bubble, coalesced streaming, terminal r ); }); -test("provider error on the assistant message is shown instead of ending silently", async (t) => { - t.after(unmountAll); +test("provider error on the assistant message is shown instead of ending silently", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "q")]); - const { w, es } = await startRun(t, "s1", "q1"); + const { w, es } = await startRun("s1", "q1"); const providerError = "The provider rejected the request (HTTP 429)"; await act(async () => { @@ -404,17 +352,16 @@ test("provider error on the assistant message is shown instead of ending silentl assert.ok(w.latest.notices.some((notice) => notice.message === providerError), "the provider error must be visible"); }); -test("a silent idle transition shows a fallback error instead of disappearing", async (t) => { - t.after(unmountAll); +test("a silent idle transition shows a fallback error instead of disappearing", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "q")]); - const { w } = await startRun(t, "s1", "q1"); + const { w } = await startRun("s1", "q1"); // Simulate the SSE terminal frame being lost while the server has already // gone idle. The online recovery path must still explain the empty stop. world.agents.set("s1", { running: false, state: {} }); await act(async () => { - winTarget.fire("online"); + window.dispatchEvent(new Event("online")); await sleep(60); }); await settle(); @@ -424,11 +371,10 @@ test("a silent idle transition shows a fallback error instead of disappearing", }); for (const completion of ["visibilitychange", "agent_end"]) { - test(`a saved response missed by SSE is recovered on ${completion} without a failure notice`, async (t) => { - t.after(unmountAll); + test(`a saved response missed by SSE is recovered on ${completion} without a failure notice`, async () => { resetWorld(); primeSession("s1", [userMsg("u0", "old question")]); - const { w, es } = await startRun(t, "s1", "new question"); + const { w, es } = await startRun("s1", "new question"); primeSession("s1", [ userMsg("u0", "old question"), userMsg("u1", "new question"), @@ -436,7 +382,10 @@ for (const completion of ["visibilitychange", "agent_end"]) { ]); await act(async () => { if (completion === "agent_end") es.emit({ type: "agent_end", isTerminal: true }); - else docTarget.fire("visibilitychange"); + else { + visibilityState = "visible"; + document.dispatchEvent(new Event("visibilitychange")); + } await sleep(60); }); await settle(); @@ -447,18 +396,18 @@ for (const completion of ["visibilitychange", "agent_end"]) { }); } -test("an older answer does not hide a current run with only tool activity", async (t) => { - t.after(unmountAll); +test("an older answer does not hide a current run with only tool activity", async () => { resetWorld(); const history = [userMsg("u0", "question"), assistantMsg("a0", "Old answer")]; primeSession("s1", history); - const { w } = await startRun(t, "s1", "question"); + const { w } = await startRun("s1", "question"); primeSession("s1", [...history, userMsg("u1", "question"), { ...assistantMsg("a1", ""), content: [{ type: "toolCall", toolCallId: "tc1", toolName: "read", input: {} }], }]); await act(async () => { - docTarget.fire("visibilitychange"); + visibilityState = "visible"; + document.dispatchEvent(new Event("visibilitychange")); await sleep(60); }); await settle(); @@ -466,13 +415,13 @@ test("an older answer does not hide a current run with only tool activity", asyn assert.equal(w.latest.notices.filter((n) => n.type === "error").length, 1); }); -test("a repeated prompt cannot reuse an old saved answer when the new prompt was not persisted", async (t) => { - t.after(unmountAll); +test("a repeated prompt cannot reuse an old saved answer when the new prompt was not persisted", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "question"), assistantMsg("a0", "Old answer")]); - const { w } = await startRun(t, "s1", "question"); + const { w } = await startRun("s1", "question"); await act(async () => { - docTarget.fire("visibilitychange"); + visibilityState = "visible"; + document.dispatchEvent(new Event("visibilitychange")); await sleep(60); }); await settle(); @@ -480,11 +429,10 @@ test("a repeated prompt cannot reuse an old saved answer when the new prompt was assert.equal(w.latest.notices.filter((n) => n.type === "error").length, 1); }); -test("recovery preserves a saved provider failure even after partial response content", async (t) => { - t.after(unmountAll); +test("recovery preserves a saved provider failure even after partial response content", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "old question")]); - const { w } = await startRun(t, "s1", "new question"); + const { w } = await startRun("s1", "new question"); const providerError = "Provider disconnected during generation"; primeSession("s1", [ userMsg("u0", "old question"), @@ -492,7 +440,8 @@ test("recovery preserves a saved provider failure even after partial response co { ...assistantMsg("a1", "Partial answer"), stopReason: "error", errorMessage: providerError }, ]); await act(async () => { - docTarget.fire("visibilitychange"); + visibilityState = "visible"; + document.dispatchEvent(new Event("visibilitychange")); await sleep(60); }); await settle(); @@ -500,18 +449,18 @@ test("recovery preserves a saved provider failure even after partial response co assert.deepEqual(w.latest.notices.filter((n) => n.type === "error").map((n) => n.message), [providerError]); }); -test("a failed transcript reload is retried instead of being classified as an empty response", async (t) => { - t.after(unmountAll); +test("a failed transcript reload is retried instead of being classified as an empty response", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "old question")]); - const { w } = await startRun(t, "s1", "new question"); + const { w } = await startRun("s1", "new question"); primeSession("s1", [userMsg("u0", "old question"), userMsg("u1", "new question"), assistantMsg("a1", "Saved answer")]); world.holds.push({ match: (method, url) => method === "GET" && url.startsWith("/api/sessions/s1?"), produce: async () => ({ status: 503, value: {} }), }); await act(async () => { - docTarget.fire("visibilitychange"); + visibilityState = "visible"; + document.dispatchEvent(new Event("visibilitychange")); await sleep(60); }); await settle(); @@ -519,7 +468,7 @@ test("a failed transcript reload is retried instead of being classified as an em assert.deepEqual(w.latest.notices.filter((n) => n.type === "error"), []); await act(async () => { - winTarget.fire("online"); + window.dispatchEvent(new Event("online")); await sleep(60); }); await settle(); @@ -529,11 +478,10 @@ test("a failed transcript reload is retried instead of being classified as an em }); for (const nextRun of ["send", "interrupt"]) { - test(`${nextRun} captures saved entries newer than the last rendered transcript`, async (t) => { - t.after(unmountAll); + test(`${nextRun} captures saved entries newer than the last rendered transcript`, async () => { resetWorld(); primeSession("s1", [userMsg("u0", "old question")]); - const { w, es } = await startRun(t, "s1", "question"); + const { w, es } = await startRun("s1", "question"); primeSession("s1", [userMsg("u0", "old question"), userMsg("u1", "question"), assistantMsg("a1", "Previous answer")]); let releaseTerminalReload; if (nextRun === "send") { @@ -570,7 +518,8 @@ for (const nextRun of ["send", "interrupt"]) { }); // The replacement never persisted a new user entry or answer. await act(async () => { - docTarget.fire("visibilitychange"); + visibilityState = "visible"; + document.dispatchEvent(new Event("visibilitychange")); await sleep(60); }); await settle(); @@ -579,11 +528,10 @@ for (const nextRun of ["send", "interrupt"]) { }); } -test("tool activity and turn_end errors do not count as a successful answer", async (t) => { - t.after(unmountAll); +test("tool activity and turn_end errors do not count as a successful answer", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "q")]); - const { w, es } = await startRun(t, "s1", "q1"); + const { w, es } = await startRun("s1", "q1"); const toolOnlyAssistant = { ...assistantMsg("a1", ""), @@ -604,11 +552,10 @@ test("tool activity and turn_end errors do not count as a successful answer", as assert.equal(w.latest.agentRunning, false); }); -test("tool output streams live before the toolResult message lands", async (t) => { - t.after(unmountAll); +test("tool output streams live before the toolResult message lands", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "q")]); - const { w, es } = await startRun(t, "s1", "q1"); + const { w, es } = await startRun("s1", "q1"); const toolCallAssistant = { ...assistantMsg("a1", ""), @@ -674,11 +621,10 @@ test("tool output streams live before the toolResult message lands", async (t) = assert.equal(w.latest.liveToolResults.size, 0, "a finished run leaves no live tool state"); }); -test("late frames after the run finished are ignored (no ghost bubble, no double completion)", async (t) => { - t.after(unmountAll); +test("late frames after the run finished are ignored (no ghost bubble, no double completion)", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "q")]); - const { w, es } = await startRun(t, "s1", "q1"); + const { w, es } = await startRun("s1", "q1"); await act(async () => { es.emit({ type: "agent_start" }); es.emit({ type: "message_end", message: userMsg("u1", "q1") }); @@ -708,11 +654,10 @@ test("late frames after the run finished are ignored (no ghost bubble, no double assert.equal(w.latest.messages.length, 3, "late message_end must not duplicate the message"); }); -test("agent_end with isTerminal=false is an async delivery pause, not a completion", async (t) => { - t.after(unmountAll); +test("agent_end with isTerminal=false is an async delivery pause, not a completion", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "q")]); - const { w, es } = await startRun(t, "s1", "q1"); + const { w, es } = await startRun("s1", "q1"); await act(async () => { es.emit({ type: "agent_start" }); es.emit({ type: "message_update", message: assistantMsg("a1", "partial") }); @@ -729,11 +674,10 @@ test("agent_end with isTerminal=false is an async delivery pause, not a completi assert.equal(w.latest.streamState.isStreaming, true); }); -test("abort_and_prompt: the aborted run's terminal agent_end is consumed, the new run keeps streaming", async (t) => { - t.after(unmountAll); +test("abort_and_prompt: the aborted run's terminal agent_end is consumed, the new run keeps streaming", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "q")]); - const { w, es } = await startRun(t, "s1", "q1"); + const { w, es } = await startRun("s1", "q1"); await act(async () => { es.emit({ type: "agent_start" }); es.emit({ type: "message_update", message: assistantMsg("a1", "old run streaming") }); @@ -780,11 +724,10 @@ test("abort_and_prompt: the aborted run's terminal agent_end is consumed, the ne assert.equal(w.latest.streamState.streamingMessage?.content?.[0]?.text, "new run streaming"); }); -test("a reconcile response that straddles a run boundary is dropped by the run-id fence", async (t) => { - t.after(unmountAll); +test("a reconcile response that straddles a run boundary is dropped by the run-id fence", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "q")]); - const { w, es } = await startRun(t, "s1", "q1"); + const { w, es } = await startRun("s1", "q1"); await act(async () => { es.emit({ type: "agent_start" }); es.emit({ type: "message_update", message: assistantMsg("a1", "streaming") }); @@ -839,11 +782,10 @@ test("a reconcile response that straddles a run boundary is dropped by the run-i assert.equal(w.latest.agentRunning, false); }); -test("fatal SSE error mid-run reconnects after 1s and the new stream delivers events", async (t) => { - t.after(unmountAll); +test("fatal SSE error mid-run reconnects after 1s and the new stream delivers events", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "q")]); - const { w, es: es1 } = await startRun(t, "s1", "q1"); + const { w, es: es1 } = await startRun("s1", "q1"); await act(async () => { es1.emit({ type: "agent_start" }); await Promise.resolve(); @@ -866,20 +808,16 @@ test("fatal SSE error mid-run reconnects after 1s and the new stream delivers ev assert.equal(w.latest.agentRunning, false, "events must flow through the replacement stream"); }); -test("unmount mid-run closes the stream and late frames cannot resurrect state", async (t) => { - t.after(unmountAll); +test("unmount mid-run closes the stream and late frames cannot resurrect state", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "q")]); - const { w, es, renderer } = await startRun(t, "s1", "q1"); + const { w, es } = await startRun("s1", "q1"); await act(async () => { es.emit({ type: "agent_start" }); await Promise.resolve(); }); - await act(async () => { - renderer.unmount(); - }); - activeRenderers.delete(renderer); + w.unmount(); assert.equal(es.closedByCaller, true, "unmount must close the EventSource"); // Frames arriving over the (closed) stream after unmount must be no-ops. @@ -891,12 +829,12 @@ test("unmount mid-run closes the stream and late frames cannot resurrect state", // --------------------------------------------------------------------------- // Recovery nets: visibilitychange / online reconcile + subagent roster -// restoration (TODO §5 leftovers). +// restoration. // --------------------------------------------------------------------------- /** Mid-run baseline used by the recovery tests. */ -async function startStreamingRun(t, sid) { - const { w, es } = await startRun(t, sid, "q1"); +async function startStreamingRun(sid) { + const { w, es } = await startRun(sid, "q1"); await act(async () => { es.emit({ type: "agent_start" }); es.emit({ type: "message_update", message: assistantMsg("a1", "streaming") }); @@ -907,17 +845,17 @@ async function startStreamingRun(t, sid) { return { w, es }; } -test("tab returns to foreground: visibilitychange fires a mid-run reconcile poll", async (t) => { - t.after(unmountAll); +test("tab returns to foreground: visibilitychange fires a mid-run reconcile poll", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "q")]); - const { w } = await startStreamingRun(t, "s1"); + const { w } = await startStreamingRun("s1"); const before = callsTo("GET", "/api/agent/s1").length; // Server still mid-run: the poll must observe busy and NOT finish the run. world.agents.set("s1", { running: true, state: { isStreaming: true } }); await act(async () => { - docTarget.fire("visibilitychange"); + visibilityState = "visible"; + document.dispatchEvent(new Event("visibilitychange")); await sleep(30); }); assert.ok( @@ -928,18 +866,17 @@ test("tab returns to foreground: visibilitychange fires a mid-run reconcile poll assert.equal(w.latest.agentRunning, true); }); -test("network returns while agent_end was missed: the online reconcile recovers the UI", async (t) => { - t.after(unmountAll); +test("network returns while agent_end was missed: the online reconcile recovers the UI", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "q")]); - const { w } = await startStreamingRun(t, "s1"); + const { w } = await startStreamingRun("s1"); // Half-open SSE: no agent_end frame ever arrived, but omp already finished. world.sessions.get("s1").messages = [userMsg("u0", "q"), userMsg("u1", "q1"), assistantMsg("a1", "streaming")]; world.agents.set("s1", { running: false, state: {} }); await act(async () => { - winTarget.fire("online"); + window.dispatchEvent(new Event("online")); await sleep(60); }); await settle(); @@ -948,11 +885,10 @@ test("network returns while agent_end was missed: the online reconcile recovers assert.equal(w.latest.messages.length, 3, "transcript reloaded from the session file"); }); -test("subagent roster is restored from the get_subagents snapshot after reconnect", async (t) => { - t.after(unmountAll); +test("subagent roster is restored from the get_subagents snapshot after reconnect", async () => { resetWorld(); primeSession("s1", [userMsg("u0", "q")]); - const { w, es: es1 } = await startStreamingRun(t, "s1"); + const { w, es: es1 } = await startStreamingRun("s1"); // Trigger a mid-run roster refresh: visibilitychange → reconcile (still // busy server-side) → refreshSubagentRoster against the configured snapshot. @@ -961,7 +897,8 @@ test("subagent roster is restored from the get_subagents snapshot after reconnec { id: "sub-1", agent: "explore", status: "started", index: 0, task: "search the codebase" }, ]); await act(async () => { - docTarget.fire("visibilitychange"); + visibilityState = "visible"; + document.dispatchEvent(new Event("visibilitychange")); await sleep(60); }); await settle(); diff --git a/hooks/useSidebarHistory.test.mjs b/hooks/useSidebarHistory.test.mjs index 9e6577e99..27cc0ee50 100644 --- a/hooks/useSidebarHistory.test.mjs +++ b/hooks/useSidebarHistory.test.mjs @@ -1,18 +1,37 @@ +import "../tests/setup-dom.mjs"; import assert from "node:assert/strict"; -import test from "node:test"; -import React, { act } from "react"; -import TestRenderer from "react-test-renderer"; +import test, { afterEach } from "node:test"; +import React from "react"; +import { act, cleanup, renderHook } from "@testing-library/react/pure.js"; import { createJiti } from "jiti"; const jiti = createJiti(import.meta.url, { tsconfigPaths: true }); const { useSidebarHistory } = await jiti.import("./useSidebarHistory.ts"); const { setDraft, getDraft, clearDraft } = await jiti.import("@/lib/draft-store"); -globalThis.IS_REACT_ACT_ENVIRONMENT = true; +let restoreHistory; +afterEach(() => { + try { + cleanup(); + } finally { + restoreHistory?.(); + restoreHistory = undefined; + } +}); -// Model asynchronous history traversal and document exit separately: a root -// history.back() really is a no-op, unlike Android's native Back/app dismissal. +// jsdom supplies the real DOM and event dispatch, not native navigation. This +// protocol model queues traversal and records document exit; root history.back() +// remains a no-op. Chromium activation/skipping, Android app dismissal, and Next +// router listener ordering still require real-browser verification. function browserHistory({ prior = true, standalone = false } = {}) { - const listeners = new Map(); + const win = window; + const originalUrl = win.location.href; + const originalState = win.history.state; + const replaceUrl = win.history.replaceState.bind(win.history); + const originals = []; + const stub = (target, key, descriptor) => { + originals.push([target, key, Object.getOwnPropertyDescriptor(target, key)]); + Object.defineProperty(target, key, { configurable: true, ...descriptor }); + }; const nextState = { __NA: true, __PRIVATE_NEXTJS_INTERNALS_TREE: { tree: "chat" }, other: "retained" }; const entries = prior ? [{ url: "https://previous.test/", state: null }] : []; entries.push({ url: "https://omp.test/?session=first", state: nextState }); @@ -21,69 +40,73 @@ function browserHistory({ prior = true, standalone = false } = {}) { let activated = false; let skippable = false; const result = { entries, departed: false, closeAttempts: 0 }; + const syncLocation = () => replaceUrl(entries[index].state, "", entries[index].url); function fire(type, extra = {}) { - const event = { type, defaultPrevented: false, stopped: false, preventDefault() { this.defaultPrevented = true; }, stopImmediatePropagation() { this.stopped = true; }, ...extra }; - for (const { fn } of [...(listeners.get(type) ?? [])]) { - fn(event); - if (event.stopped) break; - } + const event = type === "popstate" + ? new win.PopStateEvent(type, { state: extra.state }) + : new win.Event(type, { cancelable: true }); + win.dispatchEvent(event); return event; } - const win = { - activate() { activated = true; skippable = false; }, - nativeBack() { - if (skippable) result.departed = true; - else this.history.back(); + const history = { + get state() { return entries[index].state; }, + get length() { return entries.length; }, + replaceState(state, _, url) { + entries[index] = { state: structuredClone(state), url: new URL(url ?? win.location.href, win.location.href).href }; + syncLocation(); }, - location: { href: entries[index].url }, - navigation: { get canGoBack() { return index > 0; } }, - matchMedia: () => ({ matches: standalone }), - close() { result.closeAttempts += 1; }, - addEventListener(type, fn) { - if (!listeners.has(type)) listeners.set(type, []); - listeners.get(type).push({ fn }); - }, - removeEventListener(type, fn) { listeners.set(type, (listeners.get(type) ?? []).filter((l) => l.fn !== fn)); }, - history: { - get state() { return entries[index].state; }, - get length() { return entries.length; }, - replaceState(state, _, url) { - entries[index] = { state: structuredClone(state), url: new URL(url ?? win.location.href, win.location.href).href }; - win.location.href = entries[index].url; - }, - pushState(state, _, url) { - if (!activated) skippable = true; - entries.splice(index + 1); - entries.push({ state: structuredClone(state), url: new URL(url ?? win.location.href, win.location.href).href }); - index += 1; - win.location.href = entries[index].url; - }, - go(delta) { pending.push(delta); }, - back() { this.go(-1); }, - forward() { this.go(1); }, + pushState(state, _, url) { + if (!activated) skippable = true; + entries.splice(index + 1); + entries.push({ state: structuredClone(state), url: new URL(url ?? win.location.href, win.location.href).href }); + index += 1; + syncLocation(); }, + go(delta) { pending.push(delta); }, + back() { this.go(-1); }, + forward() { this.go(1); }, }; + for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(history))) { + stub(win.history, key, descriptor); + } + stub(win, "navigation", { value: { get canGoBack() { return index > 0; } } }); + stub(win, "matchMedia", { value: () => ({ matches: standalone }) }); + stub(win, "close", { value: () => { result.closeAttempts += 1; } }); // The root layout installs this bridge before Next's popstate listener. - win.addEventListener("popstate", (event) => fire("omp:sidebar-popstate", { detail: event })); - // Router integration and actual listener ordering need browser verification; - // this model tests navigation outcomes, not a simulated Next listener. + const bridge = (event) => win.dispatchEvent(new win.CustomEvent("omp:sidebar-popstate", { detail: event })); + win.addEventListener("popstate", bridge); + restoreHistory = () => { + win.removeEventListener("popstate", bridge); + for (const [target, key, descriptor] of originals.reverse()) { + if (descriptor) Object.defineProperty(target, key, descriptor); + else delete target[key]; + } + replaceUrl(originalState, "", originalUrl); + }; + syncLocation(); result.window = win; result.fire = fire; + result.activate = () => { activated = true; skippable = false; }; + result.nativeBack = () => { + if (skippable) result.departed = true; + else win.history.back(); + }; result.flush = async () => { while (pending.length) { const target = index + pending.shift(); if (target < 0 || target >= entries.length) continue; - // Chromium stops honoring earlier activation after history traversal. - // A subsequent pushState makes this document skippable by native Back. + // Model Chromium dropping earlier activation after history traversal: + // a subsequent pushState can make native Back skip the document. activated = false; if (entries[target].url.startsWith("https://previous.test/")) { if (fire("beforeunload").defaultPrevented) continue; result.departed = true; index = target; - win.location.href = entries[index].url; + // Cross-document navigation is represented by departed, not performed + // on jsdom's live document (which ReactDOM must retain for teardown). } else { index = target; - win.location.href = entries[index].url; + syncLocation(); await act(() => fire("popstate", { state: entries[index].state })); } } @@ -91,24 +114,19 @@ function browserHistory({ prior = true, standalone = false } = {}) { return result; } -async function mount(world, { open = false, strict = false, active = true } = {}) { - globalThis.window = world.window; - let api; - function Shell({ url = "first" }) { +async function mount({ open = false, strict = false, active = true } = {}) { + const hook = renderHook(({ url }) => { const [sidebarOpen, setSidebarOpen] = React.useState(open); const navigation = useSidebarHistory({ active, ready: true, sidebarOpen, setSidebarOpen, url }); - api = { ...navigation, sidebarOpen, setSidebarOpen }; - return null; - } - let renderer; - const element = (url) => strict - ? React.createElement(React.StrictMode, null, React.createElement(Shell, { url })) - : React.createElement(Shell, { url }); - await act(() => { renderer = TestRenderer.create(element("first")); }); + return { ...navigation, sidebarOpen, setSidebarOpen }; + }, { + initialProps: { url: "first" }, + wrapper: strict ? React.StrictMode : undefined, + }); return { - get api() { return api; }, - async update(url) { await act(() => renderer.update(element(url))); }, - async unmount() { await act(() => renderer.unmount()); }, + get api() { return hook.result.current; }, + async update(url) { hook.rerender({ url }); }, + async unmount() { hook.unmount(); }, }; } @@ -116,7 +134,7 @@ const draftKey = "sidebar-history-regression"; test("closed conversation Back opens the sidebar, Forward recloses it, second clean Back exits", async () => { const world = browserHistory(); - const shell = await mount(world); + const shell = await mount(); try { world.window.history.back(); await world.flush(); @@ -136,7 +154,7 @@ test("closed conversation Back opens the sidebar, Forward recloses it, second cl test("dirty second Back cancels without losing content and Leave exits without a duplicate unload prompt", async () => { const world = browserHistory(); - const shell = await mount(world); + const shell = await mount(); try { await act(() => setDraft(draftKey, { value: "keep my draft", images: [], files: [] })); world.window.history.back(); @@ -163,14 +181,14 @@ test("dirty second Back cancels without losing content and Leave exits without a test("native Back keeps a dirty conversation guarded without another tap between Back presses", async () => { const world = browserHistory(); - const shell = await mount(world); + const shell = await mount(); try { await act(() => setDraft(draftKey, { value: "do not discard", images: [], files: [] })); - world.window.activate(); - world.window.nativeBack(); + world.activate(); + world.nativeBack(); await world.flush(); assert.equal(shell.api.sidebarOpen, true); - world.window.nativeBack(); + world.nativeBack(); await world.flush(); assert.equal(world.departed, false); assert.equal(shell.api.exitConfirmationOpen, true); @@ -183,7 +201,7 @@ test("native Back keeps a dirty conversation guarded without another tap between test("session replacement, repeated close/Back, StrictMode and reload retain one history pair and Next state", async () => { const world = browserHistory(); - let shell = await mount(world, { strict: true }); + let shell = await mount({ strict: true }); try { // router.replace may replace custom state; the URL commit must retain the // existing pair rather than adding a second sentinel. @@ -199,7 +217,7 @@ test("session replacement, repeated close/Back, StrictMode and reload retain one await act(() => shell.api.setSidebarOpen(false)); } await shell.unmount(); - shell = await mount(world, { strict: true }); + shell = await mount({ strict: true }); assert.equal(world.entries.length, 3); world.window.history.back(); await world.flush(); @@ -211,20 +229,20 @@ test("session replacement, repeated close/Back, StrictMode and reload retain one test("a new-session URL committed during sidebar collapse survives the pending traversal", async () => { const world = browserHistory(); - const shell = await mount(world); + const shell = await mount(); try { await act(() => shell.api.setSidebarOpen(true)); world.window.history.replaceState({ __NA: true, __PRIVATE_NEXTJS_INTERNALS_TREE: { tree: "new-session" } }, "", "/"); await shell.update("new"); await act(() => shell.api.setSidebarOpen(false)); await act(() => setDraft(draftKey, { value: "new draft", images: [], files: [] })); - world.window.activate(); + world.activate(); await world.flush(); assert.equal(world.window.location.href, "https://omp.test/"); assert.equal(world.entries.length, 3); - world.window.nativeBack(); + world.nativeBack(); await world.flush(); - world.window.nativeBack(); + world.nativeBack(); await world.flush(); assert.equal(world.departed, false); assert.equal(shell.api.exitConfirmationOpen, true); @@ -237,7 +255,7 @@ test("a new-session URL committed during sidebar collapse survives the pending t test("desktop open sidebar has no clean interception; attachment-only stored drafts protect Back and reload", async () => { const world = browserHistory(); - const shell = await mount(world, { open: true, active: false }); + const shell = await mount({ open: true, active: false }); try { assert.equal(world.entries.length, 2); assert.equal(world.fire("beforeunload").defaultPrevented, false); @@ -261,12 +279,12 @@ test("desktop open sidebar has no clean interception; attachment-only stored dra test("wide layouts keep a collapsed sidebar unchanged while protecting drafts on the first Back", async () => { const world = browserHistory(); - const shell = await mount(world, { active: false }); + const shell = await mount({ active: false }); try { assert.equal(world.entries.length, 2); await act(() => setDraft(draftKey, { value: "desktop draft", images: [], files: [] })); - world.window.activate(); - world.window.nativeBack(); + world.activate(); + world.nativeBack(); await world.flush(); assert.equal(shell.api.exitConfirmationOpen, true); assert.equal(shell.api.sidebarOpen, false); @@ -286,9 +304,9 @@ test("wide layouts keep a collapsed sidebar unchanged while protecting drafts on test("wide layouts do not restore sidebar state from a previous mobile history entry", async () => { const world = browserHistory(); - let shell = await mount(world); + let shell = await mount(); await shell.unmount(); - shell = await mount(world, { active: false, open: true }); + shell = await mount({ active: false, open: true }); try { await world.flush(); world.window.history.forward(); @@ -300,7 +318,7 @@ test("wide layouts do not restore sidebar state from a previous mobile history e for (const standalone of [false, true]) { test(`direct ${standalone ? "standalone" : "browser"} launch confirms dirty Back and limits app-close guidance to standalone`, async () => { const world = browserHistory({ prior: false, standalone }); - const shell = await mount(world); + const shell = await mount(); try { await act(() => setDraft(draftKey, { value: "", images: [], files: [{ name: "draft.txt", content: "draft", mimeType: "text/plain", size: 5 }] })); world.window.history.back(); diff --git a/hooks/useTheme.test.mjs b/hooks/useTheme.test.mjs index 168e5dc69..002454579 100644 --- a/hooks/useTheme.test.mjs +++ b/hooks/useTheme.test.mjs @@ -1,15 +1,13 @@ +import "../tests/setup-dom.mjs"; import assert from "node:assert/strict"; -import test from "node:test"; -import { createRequire } from "node:module"; +import test, { afterEach } from "node:test"; +import { act, cleanup, renderHook } from "@testing-library/react/pure.js"; import { createJiti } from "jiti"; -const require = createRequire(import.meta.url); -const React = require("react"); -const { act } = React; -const TestRenderer = require("react-test-renderer"); - const jiti = createJiti(import.meta.url, { tsconfigPaths: true }); -const { nextThemePreference, resolveTheme, isDarkTheme, LIGHT_THEMES, DARK_THEMES, ALL_THEMES, useTheme } = await jiti.import("./useTheme.ts"); +const { nextThemePreference, resolveTheme, isDarkTheme, LIGHT_THEMES, DARK_THEMES, useTheme } = await jiti.import("./useTheme.ts"); + +afterEach(cleanup); test("cycles explicit and system theme preferences", () => { assert.equal(nextThemePreference("light"), "dark"); @@ -52,98 +50,74 @@ test("nextThemePreference toggles custom dark themes to light and custom light t assert.equal(nextThemePreference("one-light"), "dark"); }); -test("contains all requested light and dark themes in metadata", () => { - const lightIds = LIGHT_THEMES.map((t) => t.id); - const darkIds = DARK_THEMES.map((t) => t.id); - assert.deepEqual(lightIds, ["light", "one-light", "catppuccin-latte", "rose-pine-dawn"]); - assert.deepEqual(darkIds, [ - "omp", - "dark", - "dracula", - "harbor", - "one-dark-pro", - "rose-pine", - "catppuccin-mocha", - "gruvbox-dark", - "nord", - "tokyo-night", - ]); - assert.equal(ALL_THEMES.length, 14); -}); - test("browser chrome follows the selected theme and only follows OS changes in system mode", async (t) => { - const storage = new Map([["omp-theme", "dracula"]]); - const classes = new Set(); - const attributes = new Map(); - const metaAttributes = new Map([["content", "#000000"]]); - const mediaListeners = new Set(); - const media = { - matches: false, - addEventListener: (_type, listener) => mediaListeners.add(listener), - removeEventListener: (_type, listener) => mediaListeners.delete(listener), - }; - const globals = { - IS_REACT_ACT_ENVIRONMENT: true, - window: { matchMedia: () => media }, - localStorage: { - getItem: (key) => storage.get(key) ?? null, - setItem: (key, value) => storage.set(key, value), - }, - document: { - documentElement: { - classList: { - add: (cls) => classes.add(cls), - remove: (cls) => classes.delete(cls), - forEach: (callback) => classes.forEach(callback), - toggle: (cls, force) => force ? classes.add(cls) : classes.delete(cls), - }, - setAttribute: (key, value) => attributes.set(key, value), - }, - querySelector: (selector) => selector === 'meta[name="theme-color"]' - ? { setAttribute: (key, value) => metaAttributes.set(key, value) } - : null, - }, - }; - for (const [key, value] of Object.entries(globals)) { - const descriptor = Object.getOwnPropertyDescriptor(globalThis, key); - Object.defineProperty(globalThis, key, { configurable: true, writable: true, value }); - t.after(() => { - if (descriptor) Object.defineProperty(globalThis, key, descriptor); - else delete globalThis[key]; - }); - } - let current; - function Probe() { - current = useTheme(); - return null; - } - const assertTheme = (theme, color) => { - assert.equal(current.theme, theme); - assert.equal(attributes.get("data-theme"), theme); - assert.equal(metaAttributes.get("content"), color); + const root = document.documentElement; + const originalClass = root.getAttribute("class"); + const originalTheme = root.getAttribute("data-theme"); + const originalPreference = localStorage.getItem("omp-theme"); + const originalMatchMedia = Object.getOwnPropertyDescriptor(window, "matchMedia"); + const meta = document.createElement("meta"); + meta.name = "theme-color"; + meta.content = "#000000"; + document.head.append(meta); + root.className = "keep-layout dark theme-nord"; + localStorage.setItem("omp-theme", "dracula"); + + const media = Object.assign(new window.EventTarget(), { matches: false }); + Object.defineProperty(window, "matchMedia", { + configurable: true, + writable: true, + value: (query) => query === "(prefers-color-scheme: dark)" ? media : { matches: false }, + }); + t.after(() => { + cleanup(); + meta.remove(); + for (const [attribute, value] of [["class", originalClass], ["data-theme", originalTheme]]) { + if (value === null) root.removeAttribute(attribute); + else root.setAttribute(attribute, value); + } + if (originalPreference === null) localStorage.removeItem("omp-theme"); + else localStorage.setItem("omp-theme", originalPreference); + if (originalMatchMedia) Object.defineProperty(window, "matchMedia", originalMatchMedia); + else delete window.matchMedia; + }); + + let hook = renderHook(() => useTheme()); + const assertTheme = (theme, color, dark, classes, preference = theme) => { + assert.equal(hook.result.current.theme, theme); + assert.equal(hook.result.current.preference, preference); + assert.equal(hook.result.current.isDark, dark); + assert.equal(root.getAttribute("data-theme"), theme); + assert.deepEqual([...root.classList].sort(), ["keep-layout", ...classes].sort()); + assert.equal(meta.getAttribute("content"), color); + assert.equal(localStorage.getItem("omp-theme"), preference); }; const changeOS = async (dark) => { await act(() => { media.matches = dark; - for (const listener of mediaListeners) listener(); + media.dispatchEvent(new window.Event("change")); }); }; - let renderer; - try { - await act(() => { renderer = TestRenderer.create(React.createElement(Probe)); }); - assertTheme("dracula", "#282A36"); - await changeOS(true); - assertTheme("dracula", "#282A36"); - await act(() => current.setTheme("catppuccin-latte")); - assertTheme("catppuccin-latte", "#EFF1F5"); - await act(() => current.setTheme("system")); - assertTheme("dark", "#1B1916"); - await changeOS(false); - assertTheme("light", "#FAF9F6"); - await act(() => current.setTheme("omp")); - await changeOS(true); - assertTheme("omp", "#000000"); - } finally { - await act(() => renderer?.unmount()); - } + + assertTheme("dracula", "#282A36", true, ["dark", "theme-dracula"]); + await changeOS(true); + assertTheme("dracula", "#282A36", true, ["dark", "theme-dracula"]); + await act(() => hook.result.current.setTheme("catppuccin-latte")); + assertTheme("catppuccin-latte", "#EFF1F5", false, ["theme-catppuccin-latte"]); + await act(() => hook.result.current.setTheme("system")); + assertTheme("dark", "#1B1916", true, ["dark", "theme-dark"], "system"); + await changeOS(false); + assertTheme("light", "#FAF9F6", false, ["theme-light"], "system"); + await act(() => hook.result.current.setTheme("omp")); + await changeOS(true); + assertTheme("omp", "#000000", true, ["omp"]); + + await act(() => hook.result.current.setTheme("system")); + assertTheme("dark", "#1B1916", true, ["dark", "theme-dark"], "system"); + hook.unmount(); + await changeOS(false); + assert.equal(root.getAttribute("data-theme"), "dark", "unmounted consumers no longer update browser chrome"); + assert.equal(meta.getAttribute("content"), "#1B1916"); + hook = renderHook(() => useTheme()); + assertTheme("light", "#FAF9F6", false, ["theme-light"], "system"); }); diff --git a/package.json b/package.json index 7a2a4d8c2..1101966db 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,9 @@ }, "devDependencies": { "@tailwindcss/postcss": "^4.3.3", + "@testing-library/dom": "^10.4.1", + "@testing-library/react": "^16.3.3", + "@testing-library/user-event": "^14.6.7", "@types/node": "^25", "@types/react": "^19", "@types/react-dom": "^19", @@ -88,8 +91,8 @@ "eslint": "^9", "eslint-config-next": "16.3.4", "jiti": "^2.7.0", + "jsdom": "^29.1.1", "postcss": "^8", - "react-test-renderer": "^19.2.8", "tailwindcss": "^4.3.3", "typescript": "^5", "typescript-language-server": "^6.0.0" diff --git a/tests/setup-dom.mjs b/tests/setup-dom.mjs new file mode 100644 index 000000000..db4fe6b29 --- /dev/null +++ b/tests/setup-dom.mjs @@ -0,0 +1,38 @@ +import { after } from "node:test"; +import { JSDOM } from "jsdom"; + +// Import before Testing Library so its DOM queries bind to this document. +const dom = new JSDOM("", { + url: "https://omp.test/", + pretendToBeVisual: true, +}); +const globals = { + window: dom.window, + document: dom.window.document, + navigator: dom.window.navigator, + HTMLElement: dom.window.HTMLElement, + Element: dom.window.Element, + Node: dom.window.Node, + Event: dom.window.Event, + CustomEvent: dom.window.CustomEvent, + MutationObserver: dom.window.MutationObserver, + localStorage: dom.window.localStorage, + sessionStorage: dom.window.sessionStorage, + getComputedStyle: dom.window.getComputedStyle.bind(dom.window), + requestAnimationFrame: dom.window.requestAnimationFrame.bind(dom.window), + cancelAnimationFrame: dom.window.cancelAnimationFrame.bind(dom.window), + IS_REACT_ACT_ENVIRONMENT: true, +}; +const originals = new Map(); +for (const [key, value] of Object.entries(globals)) { + originals.set(key, Object.getOwnPropertyDescriptor(globalThis, key)); + Object.defineProperty(globalThis, key, { configurable: true, writable: true, value }); +} + +after(() => { + dom.window.close(); + for (const [key, descriptor] of originals) { + if (descriptor) Object.defineProperty(globalThis, key, descriptor); + else delete globalThis[key]; + } +}); From 3434e753e23d1f389586d6987d54fcc513228b4f Mon Sep 17 00:00:00 2001 From: kahme247 Date: Sun, 13 Sep 2026 18:38:18 +0300 Subject: [PATCH 2/2] fix(review): migrate MessageView interactive test off react-test-renderer, unify lockfile - MessageView.test.mjs: the grouped-tool-inputs test (added by #89 after this branch) drove Collapsible via TestRenderer internals; reworked onto Testing Library over the real DOM (row triggers, input toggles, rerender) with identical assertions. Last react-test-renderer consumer gone. - package-lock.json: regenerated for the merged dependency set (main's dbus-next plus the Testing Library/jsdom swap). --- components/MessageView.test.mjs | 64 ++- package-lock.json | 759 +++++++++++++++++++++++++++++++- 2 files changed, 765 insertions(+), 58 deletions(-) diff --git a/components/MessageView.test.mjs b/components/MessageView.test.mjs index c8b93c1bc..c25e4b3c1 100644 --- a/components/MessageView.test.mjs +++ b/components/MessageView.test.mjs @@ -1,7 +1,8 @@ import assert from "node:assert/strict"; -import test from "node:test"; -import React, { act } from "react"; -import TestRenderer from "react-test-renderer"; +import "../tests/setup-dom.mjs"; +import test, { afterEach } from "node:test"; +import React from "react"; +import { cleanup, fireEvent, render } from "@testing-library/react/pure.js"; import { renderToStaticMarkup } from "react-dom/server"; import { createJiti } from "jiti"; @@ -11,11 +12,9 @@ const jiti = createJiti(import.meta.url, { }); const { MessageView, SafeMarkdownBody, TaskResultPanel, isInterruptedMessage } = await jiti.import("./MessageView.tsx"); const { CodeBlock } = await jiti.import("./MermaidBlock.tsx"); -const { Collapsible } = await jiti.import("./ui/primitives.tsx"); +afterEach(cleanup); -test("expanded grouped tool inputs follow streaming arguments without toggling output", async () => { - const previousActEnvironment = globalThis.IS_REACT_ACT_ENVIRONMENT; - globalThis.IS_REACT_ACT_ENVIRONMENT = true; +test("expanded grouped tool inputs follow streaming arguments without toggling output", () => { const code = "print('first')\nprint('complete')"; const editInput = { path: "/tmp/example.ts", patch: "-old\n+new", options: { dryRun: false } }; const toolResults = new Map([["edit-call", { @@ -33,34 +32,29 @@ test("expanded grouped tool inputs follow streaming arguments without toggling o ], }, }); - let renderer; - try { - await act(() => { renderer = TestRenderer.create(React.createElement(MessageView, props("print('first')"))); }); - // Open both tool rows through the shared disclosure's public change handler. - await act(() => { - for (const row of renderer.root.findAllByType(Collapsible).slice(1)) row.props.onOpenChange(true); - }); - const toggles = () => renderer.root.findAllByType("button").filter((node) => node.props["aria-controls"] && node.children.includes("Show full input")); - const inputPanels = () => renderer.root.findAll((node) => node.type === "div" && node.props.className === "tool-call-input"); - assert.equal(toggles().length, 2); - assert.ok(inputPanels().every((node) => node.props.hidden)); - await act(() => { for (const toggle of toggles()) toggle.props.onClick(); }); - assert.equal(inputPanels()[0].findAllByType("pre")[1].children.join(""), "print('first')"); - assert.equal(inputPanels()[1].findAllByType("pre")[1].children.join(""), editInput.patch); - assert.deepEqual(JSON.parse(inputPanels()[1].findAllByType("pre")[2].children.join("")), editInput.options); - await act(() => renderer.update(React.createElement(MessageView, props(code)))); - assert.equal(inputPanels()[0].findAllByType("pre")[1].children.join(""), code); - const output = () => renderer.root.findAll((node) => node.type === "pre" && node.props["data-tool-output"] === "true").map((node) => node.children.join("")); - assert.deepEqual(output(), ["Edit complete"]); - await act(() => { - for (const toggle of renderer.root.findAllByType("button").filter((node) => node.children.includes("Collapse input"))) toggle.props.onClick(); - }); - assert.ok(inputPanels().every((node) => node.props.hidden)); - assert.deepEqual(output(), ["Edit complete"]); - } finally { - await act(() => renderer?.unmount()); - globalThis.IS_REACT_ACT_ENVIRONMENT = previousActEnvironment; - } + const { container, rerender } = render(React.createElement(MessageView, props("print('first')"))); + // Open both tool rows through their disclosure triggers. The collapsible + // group header is not a row, so only the group-item triggers are clicked. + const rowTriggers = () => [...container.querySelectorAll("button.activity-group-item-trigger")]; + assert.equal(rowTriggers().length, 2); + for (const trigger of rowTriggers()) fireEvent.click(trigger); + const toggles = (label) => [...container.querySelectorAll("button.tool-call-input-toggle")] + .filter((button) => (button.textContent ?? "").includes(label)); + const inputPanels = () => [...container.querySelectorAll("div.tool-call-input")]; + const pres = (panel) => [...panel.querySelectorAll("pre")]; + assert.equal(toggles("Show full input").length, 2); + assert.ok(inputPanels().every((panel) => panel.hidden)); + for (const toggle of toggles("Show full input")) fireEvent.click(toggle); + assert.equal(pres(inputPanels()[0])[1].textContent, "print('first')"); + assert.equal(pres(inputPanels()[1])[1].textContent, editInput.patch); + assert.deepEqual(JSON.parse(pres(inputPanels()[1])[2].textContent ?? ""), editInput.options); + rerender(React.createElement(MessageView, props(code))); + assert.equal(pres(inputPanels()[0])[1].textContent, code); + const output = () => [...container.querySelectorAll('pre[data-tool-output="true"]')].map((node) => node.textContent); + assert.deepEqual(output(), ["Edit complete"]); + for (const toggle of toggles("Collapse input")) fireEvent.click(toggle); + assert.ok(inputPanels().every((panel) => panel.hidden)); + assert.deepEqual(output(), ["Edit complete"]); }); test("large message content avoids the markdown pipeline until requested", () => { diff --git a/package-lock.json b/package-lock.json index 0b351fd75..bf7e75692 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,10 +32,15 @@ "bin": { "ompweb": "bin/omp-web.js", "ompweb-launchd": "bin/omp-web-launchd.js", - "ompweb-tray": "bin/omp-web-tray.js" + "ompweb-systemd": "bin/omp-web-systemd.js", + "ompweb-tray": "bin/omp-web-tray.js", + "ompweb-tray-linux": "bin/linux-tray.js" }, "devDependencies": { "@tailwindcss/postcss": "^4.3.3", + "@testing-library/dom": "^10.4.1", + "@testing-library/react": "^16.3.3", + "@testing-library/user-event": "^14.6.7", "@types/node": "^25", "@types/react": "^19", "@types/react-dom": "^19", @@ -43,8 +48,8 @@ "eslint": "^9", "eslint-config-next": "16.3.4", "jiti": "^2.7.0", + "jsdom": "^29.1.1", "postcss": "^8", - "react-test-renderer": "^19.2.8", "tailwindcss": "^4.3.3", "typescript": "^5", "typescript-language-server": "^6.0.0" @@ -79,6 +84,57 @@ "url": "https://github.com/sponsors/antfu" } }, + "node_modules/@asamuzakjp/css-color": { + "version": "5.1.11", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-5.1.11.tgz", + "integrity": "sha512-KVw6qIiCTUQhByfTd78h2yD1/00waTmm9uy/R7Ck/ctUyAPj+AEDLkQIdJW0T8+qGgj3j5bpNKK7Q3G+LedJWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/generational-cache": "^1.0.1", + "@csstools/css-calc": "^3.2.0", + "@csstools/css-color-parser": "^4.1.0", + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/dom-selector": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-7.1.1.tgz", + "integrity": "sha512-67RZDnYRc8H/8MLDgQCDE//zoqVFwajkepHZgmXrbwybzXOEwOWGPYGmALYl9J2DOLfFPPs6kKCqmbzV895hTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/generational-cache": "^1.0.1", + "@asamuzakjp/nwsapi": "^2.3.9", + "bidi-js": "^1.0.3", + "css-tree": "^3.2.1", + "is-potential-custom-element-name": "^1.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/generational-cache": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@asamuzakjp/generational-cache/-/generational-cache-1.0.1.tgz", + "integrity": "sha512-wajfB8KqzMCN2KGNFdLkReeHncd0AslUSrvHVvvYWuU8ghncRJoA50kT3zP9MVL0+9g4/67H+cdvBskj9THPzg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, + "node_modules/@asamuzakjp/nwsapi": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/@asamuzakjp/nwsapi/-/nwsapi-2.3.9.tgz", + "integrity": "sha512-n8GuYSrI9bF7FFZ/SjhwevlHc8xaVlb/7HmHelnc/PZXBD2ZR49NnN9sMMuDdEGPeeRQ5d0hqlSlEpgCX3Wl0Q==", + "dev": true, + "license": "MIT" + }, "node_modules/@babel/code-frame": { "version": "7.29.7", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", @@ -407,12 +463,165 @@ "integrity": "sha512-jigsZK+sMF/cuiB7sERuo9V7N9jx+dhmHHnQyDSVdpZwVutaBu7WvNYqMDLSgFgfB30n452TP3vjDAvFC973mA==", "license": "MIT" }, + "node_modules/@bramus/specificity": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.2.tgz", + "integrity": "sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-tree": "^3.0.0" + }, + "bin": { + "specificity": "bin/cli.js" + } + }, "node_modules/@chevrotain/types": { "version": "11.1.2", "resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-11.1.2.tgz", "integrity": "sha512-U+HFai5+zmJCkK86QsaJtoITlboZHBqrVketcO2ROv865xfCMSFpELQoz1GkX5GzME8pTa+3kbKrZHQtI0gdbw==", "license": "Apache-2.0" }, + "node_modules/@csstools/color-helpers": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.1.tgz", + "integrity": "sha512-gLNsunvwf3mCi5u5o46/Z/JcJMnhbHSaZ69rkgPzNM3J4s8hWwpPUQB6/tt0EDFyCiWzxANlx+2LJwpYj4zS1w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@csstools/css-calc": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.4.0.tgz", + "integrity": "sha512-XQKj5B7QiZcHiegCOCAzcAOJdhGgWOHbbu62h5e5mkHnn8lWcfiJhllkqWmxu5zWR9jucPHuo1iTB56P033hcg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.2.3.tgz", + "integrity": "sha512-y4LpL+lmpuyKDiEFq2PnZUVFdAjsoB/qQJod79yLNokXyW7jewi+/WJ69EfItj8A2unWtxXnGjw6LYXgXu5ZjA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^6.1.1", + "@csstools/css-calc": "^3.4.0" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.0", + "@csstools/css-tokenizer": "^4.0.0" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.0.tgz", + "integrity": "sha512-+B87qS7fIG3L5h3qwJ/IFbjoVoOe/bpOdh9hAjXbvx0o8ImEmUsGXN0inFOnk2ChCFgqkkGFQ+TpM5rbhkKe4w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^4.0.0" + } + }, + "node_modules/@csstools/css-syntax-patches-for-csstree": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.13.tgz", + "integrity": "sha512-i9ZylF5QNhmNfPA9l0vHAWK4kPrbIp6g9lKgaiIFsIBz2F/WNB7OLrzlNNcCOm+h42bkaSD2v1PG+IBPHhc3ZA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "peerDependencies": { + "css-tree": "^3.2.1" + }, + "peerDependenciesMeta": { + "css-tree": { + "optional": true + } + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.0.tgz", + "integrity": "sha512-QxULHAm7cNu72w97JUNCBFODFaXpbDg+dP8b/oWFAZ2MTRppA3U00Y2L1HqaS4J6yBqxwa/Y3nMBaxVKbB/NsA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + } + }, "node_modules/@emnapi/core": { "version": "1.11.3", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.3.tgz", @@ -665,6 +874,24 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" } }, + "node_modules/@exodus/bytes": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.15.1.tgz", + "integrity": "sha512-S6mL0yNB/Abt9Ei4tq8gDhcczc4S3+vQ4ra7vxnAf+YHC02srtqxKKZghx2Dq6p0e66THKwR6r8N6P95wEty7Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@noble/hashes": "^1.8.0 || ^2.0.0" + }, + "peerDependenciesMeta": { + "@noble/hashes": { + "optional": true + } + } + }, "node_modules/@floating-ui/core": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.8.0.tgz", @@ -2208,6 +2435,72 @@ "node": ">=14.0.0" } }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": { + "version": "1.11.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.2.2", + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": { + "version": "1.11.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": { + "version": "1.2.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": { + "version": "1.1.4", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1", + "@emnapi/runtime": "^1.7.1" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": { + "version": "0.10.2", + "dev": true, + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": { + "version": "2.8.1", + "dev": true, + "inBundle": true, + "license": "0BSD", + "optional": true + }, "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { "version": "4.3.3", "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.3.tgz", @@ -2256,6 +2549,78 @@ "tailwindcss": "4.3.3" } }, + "node_modules/@testing-library/dom": { + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz", + "integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^5.0.1", + "aria-query": "5.3.0", + "dom-accessibility-api": "^0.5.9", + "lz-string": "^1.5.0", + "picocolors": "1.1.1", + "pretty-format": "^27.0.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@testing-library/dom/node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/@testing-library/react": { + "version": "16.3.3", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.3.tgz", + "integrity": "sha512-Uo193NgQbPMz6lrrhtRQQFcMC6Re/ELLFbbuVL30WDlZxlpZf9/lMHTAVxPRLw1q1iu9OJmR1c2BLiENRstdBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.12.5" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@testing-library/dom": "^10.0.0", + "@types/react": "^18.0.0 || ^19.0.0", + "@types/react-dom": "^18.0.0 || ^19.0.0", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@testing-library/user-event": { + "version": "14.6.7", + "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.6.7.tgz", + "integrity": "sha512-MPCpX8bxe8zS+JmmTwLp8jd0dy1rAm60Te/SL8JrQM3qvQJcBOs1d7IefJMyZzqM3EWBrDn/LWDt1BCGu4ASfg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12", + "npm": ">=6" + }, + "peerDependencies": { + "@testing-library/dom": ">=7.21.4" + } + }, "node_modules/@tybys/wasm-util": { "version": "0.10.3", "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz", @@ -2267,6 +2632,13 @@ "tslib": "^2.4.0" } }, + "node_modules/@types/aria-query": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", + "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/d3": { "version": "7.4.3", "resolved": "https://registry.npmjs.org/@types/d3/-/d3-7.4.3.tgz", @@ -3628,6 +4000,16 @@ "tweetnacl": "^0.14.3" } }, + "node_modules/bidi-js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.1.0.tgz", + "integrity": "sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "require-from-string": "^2.0.2" + } + }, "node_modules/bindings": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", @@ -4009,6 +4391,20 @@ "node": ">= 8" } }, + "node_modules/css-tree": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, "node_modules/csstype": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", @@ -4543,6 +4939,20 @@ "node": ">=0.10" } }, + "node_modules/data-urls": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-7.0.0.tgz", + "integrity": "sha512-23XHcCF+coGYevirZceTVD7NdJOqVn+49IHyxgszm+JIiHLoB2TkmPtsYkNWT1pvRSGkc35L6NHs0yHkN2SumA==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^16.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, "node_modules/data-view-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", @@ -4638,6 +5048,13 @@ } } }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, "node_modules/decode-named-character-reference": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.3.0.tgz", @@ -4777,6 +5194,13 @@ "node": ">=0.10.0" } }, + "node_modules/dom-accessibility-api": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", + "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", + "dev": true, + "license": "MIT" + }, "node_modules/dompurify": { "version": "3.4.13", "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.13.tgz", @@ -6591,6 +7015,19 @@ "integrity": "sha512-PDEfEF102G23vHmPhLyPboFCD+BkMGu+GuJe2d9/eH4FsCwvgBpnc9n0pGE+ffKdph38s6foEZiEjdgHdzp+IA==", "license": "CC0-1.0" }, + "node_modules/html-encoding-sniffer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-6.0.0.tgz", + "integrity": "sha512-CV9TW3Y3f8/wT0BRFc1/KAVQ3TUHiXmaAb6VW9vtiMFf7SLoMd1PdAc4W3KFOFETBJUb90KatHqlsZMWV+R9Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.6.0" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, "node_modules/html-url-attributes": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz", @@ -7069,6 +7506,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, "node_modules/is-regex": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", @@ -7312,6 +7756,80 @@ "license": "MIT", "optional": true }, + "node_modules/jsdom": { + "version": "29.1.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-29.1.1.tgz", + "integrity": "sha512-ECi4Fi2f7BdJtUKTflYRTiaMxIB0O6zfR1fX0GXpUrf6flp8QIYn1UT20YQqdSOfk2dfkCwS8LAFoJDEppNK5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/css-color": "^5.1.11", + "@asamuzakjp/dom-selector": "^7.1.1", + "@bramus/specificity": "^2.4.2", + "@csstools/css-syntax-patches-for-csstree": "^1.1.3", + "@exodus/bytes": "^1.15.0", + "css-tree": "^3.2.1", + "data-urls": "^7.0.0", + "decimal.js": "^10.6.0", + "html-encoding-sniffer": "^6.0.0", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.3.5", + "parse5": "^8.0.1", + "saxes": "^6.0.0", + "symbol-tree": "^3.2.4", + "tough-cookie": "^6.0.1", + "undici": "^7.25.0", + "w3c-xmlserializer": "^5.0.0", + "webidl-conversions": "^8.0.1", + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^16.0.1", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24.0.0" + }, + "peerDependencies": { + "canvas": "^3.0.0" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/lru-cache": { + "version": "11.5.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz", + "integrity": "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/jsdom/node_modules/tough-cookie": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz", + "integrity": "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^7.0.5" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/jsdom/node_modules/undici": { + "version": "7.29.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.1.tgz", + "integrity": "sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, "node_modules/jsesc": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", @@ -7860,6 +8378,16 @@ "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, + "node_modules/lz-string": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", + "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", + "dev": true, + "license": "MIT", + "bin": { + "lz-string": "bin/bin.js" + } + }, "node_modules/magic-string": { "version": "0.30.21", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", @@ -8229,6 +8757,13 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/mdn-data": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", + "dev": true, + "license": "CC0-1.0" + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -9489,6 +10024,32 @@ "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", "license": "MIT" }, + "node_modules/parse5": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", + "integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^8.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/parse5/node_modules/entities": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-8.1.0.tgz", + "integrity": "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/path-data-parser": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/path-data-parser/-/path-data-parser-0.1.0.tgz", @@ -9650,6 +10211,51 @@ "node": ">= 0.8.0" } }, + "node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/pretty-format/node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true, + "license": "MIT" + }, "node_modules/prismjs": { "version": "1.30.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", @@ -9885,27 +10491,6 @@ "react": ">= 0.14.0" } }, - "node_modules/react-test-renderer": { - "version": "19.2.8", - "resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-19.2.8.tgz", - "integrity": "sha512-GHKPaDRaNYU24PHTLG8Bx8VMY9t+qNfxQbt/Yjp7aMWBkKU6766SR0n6TnYu7P5I1MfEuAMUadqiyDHyI4Yy9Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "react-is": "^19.2.8", - "scheduler": "^0.27.0" - }, - "peerDependencies": { - "react": "^19.2.8" - } - }, - "node_modules/react-test-renderer/node_modules/react-is": { - "version": "19.2.8", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.8.tgz", - "integrity": "sha512-s5un28nYxKJw5gvUHyW5PCC28CvBqLu9r3cWgzHT4Vo/5fqqkFcdRYsGcKf50WMPpjjFZS5d76fn3YCo2njKwQ==", - "dev": true, - "license": "MIT" - }, "node_modules/readable-stream": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", @@ -10156,6 +10741,16 @@ "node": ">= 6" } }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/reselect": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.3.0.tgz", @@ -10369,6 +10964,19 @@ "node": ">=11.0.0" } }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, "node_modules/scheduler": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", @@ -10981,6 +11589,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/symbol-tree": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", + "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", + "dev": true, + "license": "MIT" + }, "node_modules/tailwindcss": { "version": "4.3.3", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.3.tgz", @@ -11091,6 +11706,26 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/tldts": { + "version": "7.4.12", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.12.tgz", + "integrity": "sha512-WylhSDKVeYnWXL3a+vKTaOxjnOeEGw938hImY8zoRWJjRRK/Jp1K+IihBzIONpUmW4e3WmXT6q5FW6vlESVZCA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^7.4.12" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "7.4.12", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.12.tgz", + "integrity": "sha512-nYNzS2WRf4QJmjzFFgAxLOBjyBxAGRbCy9PVBPaglcYyYajh40VBn+v5Ngr96ZMc7oM0+aCJdtQnNejvdBnXMQ==", + "dev": true, + "license": "MIT" + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -11118,6 +11753,19 @@ "node": ">=0.8" } }, + "node_modules/tr46": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-6.0.0.tgz", + "integrity": "sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/trim-lines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", @@ -11725,6 +12373,19 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/w3c-xmlserializer": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", + "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/web-namespaces": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-2.0.1.tgz", @@ -11735,6 +12396,41 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-mimetype": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", + "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-url": { + "version": "16.0.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-16.0.1.tgz", + "integrity": "sha512-1to4zXBxmXHV3IiSSEInrreIlu02vUOvrhxJJH5vcxYTBDAx51cqZiKdyTxlecdKNSjj8EcxGBxNf6Vg+945gw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.11.0", + "tr46": "^6.0.0", + "webidl-conversions": "^8.0.1" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -11867,6 +12563,16 @@ "license": "ISC", "optional": true }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, "node_modules/xml2js": { "version": "0.4.23", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.23.tgz", @@ -11898,6 +12604,13 @@ "node": ">=4.0" } }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + }, "node_modules/yallist": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",