Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
test: use happy dom (#34154)
Stephen Zhou07f4950cb320
diff --git a/web/app/components/app/app-access-control/access-control.spec.tsx b/web/app/components/app/app-access-control/access-control.spec.tsxindex 3950bdf7ee7..3a5f2272edd 100644--- a/web/app/components/app/app-access-control/access-control.spec.tsx+++ b/web/app/components/app/app-access-control/access-control.spec.tsx@@ -109,7 +109,7 @@ beforeAll(() => {disconnect = vi.fn(() => undefined)unobserve = vi.fn(() => undefined)}- // @ts-expect-error jsdom does not implement IntersectionObserver+ // @ts-expect-error test DOM typings do not guarantee IntersectionObserver hereglobalThis.IntersectionObserver = MockIntersectionObserver})diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/index.spec.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/index.spec.tsxindex 188086246a5..389ab189e9f 100644--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/index.spec.tsx+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/index.spec.tsx@@ -556,8 +556,8 @@ describe('DebugWithMultipleModel', () => {)const twoItems = screen.getAllByTestId('debug-item')- expect(twoItems[0].style.width).toBe('calc(50% - 28px)')- expect(twoItems[1].style.width).toBe('calc(50% - 28px)')+ expect(twoItems[0].style.width).toBe('calc(50% - 4px - 24px)')+ expect(twoItems[1].style.width).toBe('calc(50% - 4px - 24px)')})})@@ -596,13 +596,13 @@ describe('DebugWithMultipleModel', () => {// Assertexpect(items).toHaveLength(2)expectItemLayout(items[0], {- width: 'calc(50% - 28px)',+ width: 'calc(50% - 4px - 24px)',height: '100%',transform: 'translateX(0) translateY(0)',classes: ['mr-2'],})expectItemLayout(items[1], {- width: 'calc(50% - 28px)',+ width: 'calc(50% - 4px - 24px)',height: '100%',transform: 'translateX(calc(100% + 8px)) translateY(0)',classes: [],@@ -620,19 +620,19 @@ describe('DebugWithMultipleModel', () => {// Assertexpect(items).toHaveLength(3)expectItemLayout(items[0], {- width: 'calc(33.3% - 21.33px)',+ width: 'calc(33.3% - 5.33px - 16px)',height: '100%',transform: 'translateX(0) translateY(0)',classes: ['mr-2'],})expectItemLayout(items[1], {- width: 'calc(33.3% - 21.33px)',+ width: 'calc(33.3% - 5.33px - 16px)',height: '100%',transform: 'translateX(calc(100% + 8px)) translateY(0)',classes: ['mr-2'],})expectItemLayout(items[2], {- width: 'calc(33.3% - 21.33px)',+ width: 'calc(33.3% - 5.33px - 16px)',height: '100%',transform: 'translateX(calc(200% + 16px)) translateY(0)',classes: [],@@ -655,25 +655,25 @@ describe('DebugWithMultipleModel', () => {// Assertexpect(items).toHaveLength(4)expectItemLayout(items[0], {- width: 'calc(50% - 28px)',+ width: 'calc(50% - 4px - 24px)',height: 'calc(50% - 4px)',transform: 'translateX(0) translateY(0)',classes: ['mr-2', 'mb-2'],})expectItemLayout(items[1], {- width: 'calc(50% - 28px)',+ width: 'calc(50% - 4px - 24px)',height: 'calc(50% - 4px)',transform: 'translateX(calc(100% + 8px)) translateY(0)',classes: ['mb-2'],})expectItemLayout(items[2], {- width: 'calc(50% - 28px)',+ width: 'calc(50% - 4px - 24px)',height: 'calc(50% - 4px)',transform: 'translateX(0) translateY(calc(100% + 8px))',classes: ['mr-2'],})expectItemLayout(items[3], {- width: 'calc(50% - 28px)',+ width: 'calc(50% - 4px - 24px)',height: 'calc(50% - 4px)',transform: 'translateX(calc(100% + 8px)) translateY(calc(100% + 8px))',classes: [],diff --git a/web/app/components/app/overview/settings/index.spec.tsx b/web/app/components/app/overview/settings/index.spec.tsxindex b849b4f0156..e933855ca8d 100644--- a/web/app/components/app/overview/settings/index.spec.tsx+++ b/web/app/components/app/overview/settings/index.spec.tsx@@ -1,6 +1,3 @@-/**- * @vitest-environment jsdom- */import type { ReactNode } from 'react'import type { ModalContextState } from '@/context/modal-context'import type { ProviderContextState } from '@/context/provider-context'diff --git a/web/app/components/base/action-button/__tests__/index.spec.tsx b/web/app/components/base/action-button/__tests__/index.spec.tsxindex 949a980272d..e9db157d0c2 100644--- a/web/app/components/base/action-button/__tests__/index.spec.tsx+++ b/web/app/components/base/action-button/__tests__/index.spec.tsx@@ -62,8 +62,8 @@ describe('ActionButton', () => {)const button = screen.getByRole('button', { name: 'Custom Style' })expect(button).toHaveStyle({- color: 'rgb(255, 0, 0)',- backgroundColor: 'rgb(0, 0, 255)',+ color: 'red',+ backgroundColor: 'blue',})})diff --git a/web/app/components/base/chat/chat/__tests__/index.spec.tsx b/web/app/components/base/chat/chat/__tests__/index.spec.tsxindex 781b5e86f31..0100b059f01 100644--- a/web/app/components/base/chat/chat/__tests__/index.spec.tsx+++ b/web/app/components/base/chat/chat/__tests__/index.spec.tsx@@ -8,10 +8,10 @@ import Chat from '../index'// ─── Why each mock exists ─────────────────────────────────────────────────────//// Answer – transitively pulls Markdown (rehype/remark/katex), AgentContent,-// WorkflowProcessItem and Operation; none can resolve in jsdom.+// WorkflowProcessItem and Operation; none can resolve in the test DOM runtime.// Question – pulls Markdown, copy-to-clipboard, react-textarea-autosize.// ChatInputArea – pulls js-audio-recorder (requires Web Audio API unavailable in-// jsdom) and VoiceInput / FileContextProvider chains.+// the test DOM runtime) and VoiceInput / FileContextProvider chains.// PromptLogModal– pulls CopyFeedbackNew and deep modal dep chain.// AgentLogModal – pulls @remixicon/react (causes lint push error), useClickAway// from ahooks, and AgentLogDetail (workflow graph renderer).diff --git a/web/app/components/base/date-and-time-picker/calendar/__tests__/index.spec.tsx b/web/app/components/base/date-and-time-picker/calendar/__tests__/index.spec.tsxindex d8e00780b1e..8839798c15e 100644--- a/web/app/components/base/date-and-time-picker/calendar/__tests__/index.spec.tsx+++ b/web/app/components/base/date-and-time-picker/calendar/__tests__/index.spec.tsx@@ -3,7 +3,7 @@ import { fireEvent, render, screen } from '@testing-library/react'import dayjs from '../../utils/dayjs'import Calendar from '../index'-// Mock scrollIntoView since jsdom doesn't implement it+// Mock scrollIntoView since the test DOM runtime doesn't implement itbeforeAll(() => {Element.prototype.scrollIntoView = vi.fn()})diff --git a/web/app/components/base/date-and-time-picker/time-picker/__tests__/index.spec.tsx b/web/app/components/base/date-and-time-picker/time-picker/__tests__/index.spec.tsxindex 910faf9cd42..199ed4ee411 100644--- a/web/app/components/base/date-and-time-picker/time-picker/__tests__/index.spec.tsx+++ b/web/app/components/base/date-and-time-picker/time-picker/__tests__/index.spec.tsx@@ -3,7 +3,7 @@ import { fireEvent, render, screen, within } from '@testing-library/react'import dayjs, { isDayjsObject } from '../../utils/dayjs'import TimePicker from '../index'-// Mock scrollIntoView since jsdom doesn't implement it+// Mock scrollIntoView since the test DOM runtime doesn't implement itbeforeAll(() => {Element.prototype.scrollIntoView = vi.fn()})diff --git a/web/app/components/base/file-uploader/file-from-link-or-local/index.tsx b/web/app/components/base/file-uploader/file-from-link-or-local/index.tsxindex 69496903a67..de9cc7ecd00 100644--- a/web/app/components/base/file-uploader/file-from-link-or-local/index.tsx+++ b/web/app/components/base/file-uploader/file-from-link-or-local/index.tsx@@ -37,11 +37,11 @@ const FileFromLinkOrLocal = ({const { handleLoadFileFromLink } = useFile(fileConfig)const disabled = !!fileConfig.number_limits && files.length >= fileConfig.number_limitsconst fileLinkPlaceholder = t('fileUploader.pasteFileLinkInputPlaceholder', { ns: 'common' })- /* v8 ignore next -- fallback for missing i18n key is not reliably testable under current global translation mocks in jsdom @preserve */+ /* v8 ignore next -- fallback for a missing i18n key is not reliably testable under the current global translation mocks in the test DOM runtime. @preserve */const fileLinkPlaceholderText = fileLinkPlaceholder || ''const handleSaveUrl = () => {- /* v8 ignore next -- guarded by UI-level disabled state (`disabled={!url || disabled}`), not reachable in jsdom click flow @preserve */+ /* v8 ignore next -- guarded by UI-level disabled state (`disabled={!url || disabled}`), not reachable in the current test click flow. @preserve */if (!url)returndiff --git a/web/app/components/base/icons/__tests__/utils.spec.ts b/web/app/components/base/icons/__tests__/utils.spec.tsindex a25f39111d9..f8534038bfa 100644--- a/web/app/components/base/icons/__tests__/utils.spec.ts+++ b/web/app/components/base/icons/__tests__/utils.spec.ts@@ -62,7 +62,7 @@ describe('generate icon base utils', () => {const { container } = render(generate(node, 'key'))// to svg elementexpect(container.firstChild).toHaveClass('container')- expect(container.querySelector('span')).toHaveStyle({ color: 'rgb(0, 0, 255)' })+ expect(container.querySelector('span')).toHaveStyle({ color: 'blue' })})// add not has childrendiff --git a/web/app/components/base/input/__tests__/index.spec.tsx b/web/app/components/base/input/__tests__/index.spec.tsxindex 2c5b563a127..dfab8617c28 100644--- a/web/app/components/base/input/__tests__/index.spec.tsx+++ b/web/app/components/base/input/__tests__/index.spec.tsx@@ -99,7 +99,7 @@ describe('Input component', () => {render(<Input className={customClass} styleCss={customStyle} />)const input = screen.getByPlaceholderText(/input/i)expect(input).toHaveClass(customClass)- expect(input).toHaveStyle({ color: 'rgb(255, 0, 0)' })+ expect(input).toHaveStyle({ color: 'red' })})it('applies large size variant correctly', () => {diff --git a/web/app/components/base/markdown-blocks/__tests__/code-block.spec.tsx b/web/app/components/base/markdown-blocks/__tests__/code-block.spec.tsxindex 745b7657d71..a16686801c6 100644--- a/web/app/components/base/markdown-blocks/__tests__/code-block.spec.tsx+++ b/web/app/components/base/markdown-blocks/__tests__/code-block.spec.tsx@@ -1,6 +1,6 @@-import { createRequire } from 'node:module'import { act, render, screen, waitFor } from '@testing-library/react'import userEvent from '@testing-library/user-event'+import * as echarts from 'echarts'import { Theme } from '@/types/app'import CodeBlock from '../code-block'@@ -10,12 +10,21 @@ type UseThemeReturn = {}const mockUseTheme = vi.fn<() => UseThemeReturn>(() => ({ theme: Theme.light }))-const require = createRequire(import.meta.url)-const echartsCjs = require('echarts') as {- getInstanceByDom: (dom: HTMLDivElement | null) => {- resize: (opts?: { width?: string, height?: string }) => void- } | null-}+const mockEcharts = vi.hoisted(() => {+ const state = {+ finishedHandler: undefined as undefined | ((event?: unknown) => void),+ echartsInstance: {+ resize: vi.fn<(opts?: { width?: string, height?: string }) => void>(),+ trigger: vi.fn((eventName: string, event?: unknown) => {+ if (eventName === 'finished')+ state.finishedHandler?.(event)+ }),+ },+ getInstanceByDom: vi.fn(() => state.echartsInstance),+ }++ return state+})let clientWidthSpy: { mockRestore: () => void } | null = nulllet clientHeightSpy: { mockRestore: () => void } | null = null@@ -61,6 +70,42 @@ vi.mock('@/hooks/use-theme', () => ({default: () => mockUseTheme(),}))+vi.mock('echarts', () => ({+ getInstanceByDom: mockEcharts.getInstanceByDom,+}))++vi.mock('echarts-for-react', async () => {+ const React = await vi.importActual<typeof import('react')>('react')++ const MockReactEcharts = React.forwardRef(({+ onChartReady,+ onEvents,+ }: {+ onChartReady?: (instance: typeof mockEcharts.echartsInstance) => void+ onEvents?: { finished?: (event?: unknown) => void }+ }, ref: React.ForwardedRef<{ getEchartsInstance: () => typeof mockEcharts.echartsInstance }>) => {+ React.useImperativeHandle(ref, () => ({+ getEchartsInstance: () => mockEcharts.echartsInstance,+ }))++ React.useEffect(() => {+ mockEcharts.finishedHandler = onEvents?.finished+ onChartReady?.(mockEcharts.echartsInstance)+ onEvents?.finished?.({})+ return () => {+ mockEcharts.finishedHandler = undefined+ }+ }, [onChartReady, onEvents])++ return <div className="echarts-for-react" />+ })++ return {+ __esModule: true,+ default: MockReactEcharts,+ }+})+vi.mock('@/app/components/base/mermaid', () => ({__esModule: true,default: ({ PrimitiveCode }: { PrimitiveCode: string }) => <div data-testid="mock-mermaid">{PrimitiveCode}</div>,@@ -76,9 +121,9 @@ const findEchartsHost = async () => {const findEchartsInstance = async () => {const host = await findEchartsHost()await waitFor(() => {- expect(echartsCjs.getInstanceByDom(host)).toBeTruthy()+ expect(echarts.getInstanceByDom(host)).toBeTruthy()})- return echartsCjs.getInstanceByDom(host)!+ return echarts.getInstanceByDom(host)!}describe('CodeBlock', () => {diff --git a/web/app/components/base/node-status/__tests__/index.spec.tsx b/web/app/components/base/node-status/__tests__/index.spec.tsxindex f74af4965e7..37b12946c8e 100644--- a/web/app/components/base/node-status/__tests__/index.spec.tsx+++ b/web/app/components/base/node-status/__tests__/index.spec.tsx@@ -41,7 +41,7 @@ describe('NodeStatus', () => {it('applies styleCss correctly', () => {const { container } = render(<NodeStatus styleCss={{ color: 'red' }} />)- expect(container.firstChild).toHaveStyle({ color: 'rgb(255, 0, 0)' })+ expect(container.firstChild).toHaveStyle({ color: 'red' })})it('applies iconClassName to the icon', () => {diff --git a/web/app/components/base/pagination/__tests__/pagination.spec.tsx b/web/app/components/base/pagination/__tests__/pagination.spec.tsxindex 776802ff19a..06eac9bfbd8 100644--- a/web/app/components/base/pagination/__tests__/pagination.spec.tsx+++ b/web/app/components/base/pagination/__tests__/pagination.spec.tsx@@ -131,7 +131,7 @@ describe('Pagination', () => {setCurrentPage,children: <Pagination.PrevButton>Prev</Pagination.PrevButton>,})- fireEvent.keyPress(screen.getByText(/prev/i), { key: 'Enter', charCode: 13 })+ fireEvent.keyDown(screen.getByText(/prev/i).closest('button')!, { key: 'Enter', code: 'Enter', keyCode: 13, which: 13 })expect(setCurrentPage).toHaveBeenCalledWith(2)})@@ -142,7 +142,7 @@ describe('Pagination', () => {setCurrentPage,children: <Pagination.PrevButton>Prev</Pagination.PrevButton>,})- fireEvent.keyPress(screen.getByText(/prev/i), { key: 'Enter', charCode: 13 })+ fireEvent.keyDown(screen.getByText(/prev/i).closest('button')!, { key: 'Enter', code: 'Enter', keyCode: 13, which: 13 })expect(setCurrentPage).not.toHaveBeenCalled()})@@ -213,7 +213,7 @@ describe('Pagination', () => {setCurrentPage,children: <Pagination.NextButton>Next</Pagination.NextButton>,})- fireEvent.keyPress(screen.getByText(/next/i), { key: 'Enter', charCode: 13 })+ fireEvent.keyDown(screen.getByText(/next/i).closest('button')!, { key: 'Enter', code: 'Enter', keyCode: 13, which: 13 })expect(setCurrentPage).toHaveBeenCalledWith(1)})@@ -225,7 +225,7 @@ describe('Pagination', () => {setCurrentPage,children: <Pagination.NextButton>Next</Pagination.NextButton>,})- fireEvent.keyPress(screen.getByText(/next/i), { key: 'Enter', charCode: 13 })+ fireEvent.keyDown(screen.getByText(/next/i).closest('button')!, { key: 'Enter', code: 'Enter', keyCode: 13, which: 13 })expect(setCurrentPage).not.toHaveBeenCalled()})@@ -318,7 +318,7 @@ describe('Pagination', () => {/>),})- fireEvent.keyPress(screen.getByText('4'), { key: 'Enter', charCode: 13 })+ fireEvent.keyDown(screen.getByText('4').closest('a')!, { key: 'Enter', code: 'Enter', keyCode: 13, which: 13 })expect(setCurrentPage).toHaveBeenCalledWith(3) // 0-indexed})diff --git a/web/app/components/base/pagination/pagination.tsx b/web/app/components/base/pagination/pagination.tsxindex 0eb06b594c7..b258090d80d 100644--- a/web/app/components/base/pagination/pagination.tsx+++ b/web/app/components/base/pagination/pagination.tsx@@ -50,7 +50,7 @@ export const PrevButton = ({tabIndex={disabled ? '-1' : 0}disabled={disabled}data-testid={dataTestId}- onKeyPress={(event: React.KeyboardEvent) => {+ onKeyDown={(event: React.KeyboardEvent) => {event.preventDefault()if (event.key === 'Enter' && !disabled)previous()@@ -85,7 +85,7 @@ export const NextButton = ({tabIndex={disabled ? '-1' : 0}disabled={disabled}data-testid={dataTestId}- onKeyPress={(event: React.KeyboardEvent) => {+ onKeyDown={(event: React.KeyboardEvent) => {event.preventDefault()if (event.key === 'Enter' && !disabled)next()@@ -140,7 +140,7 @@ export const PageButton = ({}) || undefined}tabIndex={0}- onKeyPress={(event: React.KeyboardEvent) => {+ onKeyDown={(event: React.KeyboardEvent) => {if (event.key === 'Enter')pagination.setCurrentPage(page - 1)}}diff --git a/web/app/components/base/premium-badge/__tests__/index.spec.tsx b/web/app/components/base/premium-badge/__tests__/index.spec.tsxindex af8ace22f03..d107c07e52e 100644--- a/web/app/components/base/premium-badge/__tests__/index.spec.tsx+++ b/web/app/components/base/premium-badge/__tests__/index.spec.tsx@@ -41,6 +41,6 @@ describe('PremiumBadge', () => {)const badge = screen.getByText('Premium')expect(badge).toBeInTheDocument()- expect(badge).toHaveStyle('background-color: rgb(255, 0, 0)') // Note: React converts 'red' to 'rgb(255, 0, 0)'+ expect(badge).toHaveStyle('background-color: red')})})diff --git a/web/app/components/base/prompt-editor/plugins/shortcuts-popup-plugin/index.tsx b/web/app/components/base/prompt-editor/plugins/shortcuts-popup-plugin/index.tsxindex abe6ea9a452..7dcda803f23 100644--- a/web/app/components/base/prompt-editor/plugins/shortcuts-popup-plugin/index.tsx+++ b/web/app/components/base/prompt-editor/plugins/shortcuts-popup-plugin/index.tsx@@ -141,7 +141,7 @@ export default function ShortcutsPopupPlugin({const portalRef = useRef<HTMLDivElement | null>(null)const lastSelectionRef = useRef<Range | null>(null)- /* v8 ignore next -- defensive non-browser fallback; this client-only plugin runs where document exists (browser/jsdom). @preserve */+ /* v8 ignore next -- defensive non-browser fallback; this client-only plugin runs where document exists (browser/test DOM runtime). @preserve */const containerEl = useMemo(() => container ?? (typeof document !== 'undefined' ? document.body : null), [container])const useContainer = !!containerEl && containerEl !== document.body@@ -210,7 +210,7 @@ export default function ShortcutsPopupPlugin({if (rect.width === 0 && rect.height === 0) {const root = editor.getRootElement()- /* v8 ignore next 10 -- zero-size rect recovery depends on browser layout/selection geometry; deterministic reproduction in jsdom is unreliable. @preserve */+ /* v8 ignore next 10 -- zero-size rect recovery depends on browser layout/selection geometry; deterministic reproduction in the test DOM runtime is unreliable. @preserve */if (root) {const sc = range.startContainerconst node = sc.nodeType === Node.ELEMENT_NODEdiff --git a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/__tests__/index.spec.tsx b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/__tests__/index.spec.tsxindex 7f292c8ff9b..0a3470420c6 100644--- a/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/__tests__/index.spec.tsx+++ b/web/app/components/datasets/create-from-pipeline/create-options/create-from-dsl-modal/__tests__/index.spec.tsx@@ -1612,9 +1612,7 @@ describe('Uploader', () => {if (!dropArea)return- fireEvent.drop(dropArea, {- dataTransfer: null,- })+ fireEvent.drop(dropArea)expect(updateFile).not.toHaveBeenCalled()})diff --git a/web/app/components/datasets/create/website/watercrawl/__tests__/index.spec.tsx b/web/app/components/datasets/create/website/watercrawl/__tests__/index.spec.tsxindex 5ff2d8efb88..e9d933cc031 100644--- a/web/app/components/datasets/create/website/watercrawl/__tests__/index.spec.tsx+++ b/web/app/components/datasets/create/website/watercrawl/__tests__/index.spec.tsx@@ -1,6 +1,3 @@-/**- * @vitest-environment jsdom- */import type { Mock } from 'vitest'import type { CrawlOptions, CrawlResultItem } from '@/models/datasets'import { fireEvent, render, screen, waitFor } from '@testing-library/react'diff --git a/web/app/components/develop/__tests__/code.spec.tsx b/web/app/components/develop/__tests__/code.spec.tsxindex 452e6ea98f6..e5eaebb6004 100644--- a/web/app/components/develop/__tests__/code.spec.tsx+++ b/web/app/components/develop/__tests__/code.spec.tsx@@ -11,7 +11,7 @@ describe('code.tsx components', () => {vi.clearAllMocks()vi.spyOn(console, 'error').mockImplementation(() => {})vi.useFakeTimers({ shouldAdvanceTime: true })- // jsdom does not implement scrollBy; mock it to prevent stderr noise+ // The test DOM runtime does not implement scrollBy; mock it to prevent stderr noisewindow.scrollBy = vi.fn()})diff --git a/web/app/components/develop/__tests__/use-doc-toc.spec.ts b/web/app/components/develop/__tests__/use-doc-toc.spec.tsindex e437e13065a..b20c2c8ecfe 100644--- a/web/app/components/develop/__tests__/use-doc-toc.spec.ts+++ b/web/app/components/develop/__tests__/use-doc-toc.spec.ts@@ -307,7 +307,7 @@ describe('useDocToc', () => {it('should update activeSection when scrolling past a section', async () => {vi.useFakeTimers()- // innerHeight/2 = 384 in jsdom (default 768), so top <= 384 means "scrolled past"+ // innerHeight/2 = 384 with the default test viewport height (768), so top <= 384 means "scrolled past"const { scrollContainer, cleanup } = setupScrollDOM([{ id: 'intro', text: 'Intro', top: 100 },{ id: 'details', text: 'Details', top: 600 },diff --git a/web/app/components/header/account-setting/model-provider-page/model-auth/__tests__/add-custom-model.spec.tsx b/web/app/components/header/account-setting/model-provider-page/model-auth/__tests__/add-custom-model.spec.tsxindex 6117420afae..43a27dac9b4 100644--- a/web/app/components/header/account-setting/model-provider-page/model-auth/__tests__/add-custom-model.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-auth/__tests__/add-custom-model.spec.tsx@@ -43,7 +43,7 @@ vi.mock('@/app/components/base/tooltip', () => ({),}))-// Mock portal components to avoid async/jsdom issues (consistent with sibling tests)+// Mock portal components to avoid async test DOM issues (consistent with sibling tests)vi.mock('@/app/components/base/portal-to-follow-elem', () => ({PortalToFollowElem: ({ children, open }: { children: React.ReactNode, open: boolean, onOpenChange: (open: boolean) => void }) => (<div data-testid="portal" data-open={open}>diff --git a/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-card.spec.tsx b/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-card.spec.tsxindex 237c72adf0c..2af14c5864c 100644--- a/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-card.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/__tests__/endpoint-card.spec.tsx@@ -142,7 +142,7 @@ describe('EndpointCard', () => {failureFlags.disable = falsefailureFlags.delete = falsefailureFlags.update = false- // Polyfill document.execCommand for copy-to-clipboard in jsdom+ // Polyfill document.execCommand for copy-to-clipboard in the test DOM runtimeif (typeof document.execCommand !== 'function') {document.execCommand = vi.fn().mockReturnValue(true)}diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/oauth-client.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/oauth-client.spec.tsxindex ce53bf5b9a1..5c4407b3c54 100644--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/oauth-client.spec.tsx+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/__tests__/oauth-client.spec.tsx@@ -102,10 +102,12 @@ vi.mock('@/app/components/base/ui/toast', () => ({}))const mockClipboardWriteText = vi.fn()-Object.assign(navigator, {- clipboard: {+Object.defineProperty(navigator, 'clipboard', {+ value: {writeText: mockClipboardWriteText,},+ configurable: true,+ writable: true,})vi.mock('@/app/components/base/modal/modal', () => ({@@ -192,6 +194,13 @@ describe('OAuthClientSettingsModal', () => {vi.clearAllMocks()mockUsePluginStore.mockReturnValue(mockPluginDetail)mockClipboardWriteText.mockResolvedValue(undefined)+ Object.defineProperty(navigator, 'clipboard', {+ value: {+ writeText: mockClipboardWriteText,+ },+ configurable: true,+ writable: true,+ })setMockFormValues({values: { client_id: 'test-client-id', client_secret: 'test-client-secret' },isCheckValidated: true,diff --git a/web/app/components/workflow/__tests__/custom-edge-linear-gradient-render.spec.tsx b/web/app/components/workflow/__tests__/custom-edge-linear-gradient-render.spec.tsxindex e962923158b..973dfacbc80 100644--- a/web/app/components/workflow/__tests__/custom-edge-linear-gradient-render.spec.tsx+++ b/web/app/components/workflow/__tests__/custom-edge-linear-gradient-render.spec.tsx@@ -48,10 +48,10 @@ describe('CustomEdgeLinearGradientRender', () => {const stops = container.querySelectorAll('stop')expect(stops).toHaveLength(2)expect(stops[0]).toHaveAttribute('offset', '0%')- expect(stops[0].getAttribute('style')).toContain('stop-color: rgb(17, 17, 17)')+ expect(stops[0].getAttribute('style')).toContain('stop-color: #111111')expect(stops[0].getAttribute('style')).toContain('stop-opacity: 1')expect(stops[1]).toHaveAttribute('offset', '100%')- expect(stops[1].getAttribute('style')).toContain('stop-color: rgb(34, 34, 34)')+ expect(stops[1].getAttribute('style')).toContain('stop-color: #222222')expect(stops[1].getAttribute('style')).toContain('stop-opacity: 1')})})diff --git a/web/app/components/workflow/__tests__/update-dsl-modal.spec.tsx b/web/app/components/workflow/__tests__/update-dsl-modal.spec.tsxindex 82645f2028c..961ab6ddb48 100644--- a/web/app/components/workflow/__tests__/update-dsl-modal.spec.tsx+++ b/web/app/components/workflow/__tests__/update-dsl-modal.spec.tsx@@ -209,7 +209,7 @@ describe('UpdateDSLModal', () => {})await waitFor(() => {- expect(screen.getByRole('button', { name: 'app.newApp.Cancel' })).toBeInTheDocument()+ expect(screen.getByRole('button', { name: 'app.newApp.Confirm' })).toBeInTheDocument()}, { timeout: 1000 })fireEvent.click(screen.getByRole('button', { name: 'app.newApp.Cancel' }))diff --git a/web/app/components/workflow/nodes/trigger-schedule/components/__tests__/integration.spec.tsx b/web/app/components/workflow/nodes/trigger-schedule/components/__tests__/integration.spec.tsxindex 00a6cbbe298..f2441e78d0b 100644--- a/web/app/components/workflow/nodes/trigger-schedule/components/__tests__/integration.spec.tsx+++ b/web/app/components/workflow/nodes/trigger-schedule/components/__tests__/integration.spec.tsx@@ -1,6 +1,6 @@/* eslint-disable ts/no-explicit-any */import type { ScheduleTriggerNodeType } from '../../types'-import { fireEvent, render, screen, waitFor, within } from '@testing-library/react'+import { render, screen, waitFor, within } from '@testing-library/react'import userEvent from '@testing-library/user-event'import FrequencySelector from '../frequency-selector'import ModeSwitcher from '../mode-switcher'@@ -44,14 +44,14 @@ describe('trigger-schedule components', () => {)const trigger = screen.getByRole('button', { name: 'workflow.nodes.triggerSchedule.frequency.daily' })- fireEvent.click(trigger)+ await user.click(trigger)await waitFor(() => {expect(trigger).toHaveAttribute('aria-expanded', 'true')})const listbox = await screen.findByRole('listbox')- await user.click(within(listbox).getByText('workflow.nodes.triggerSchedule.frequency.weekly'))+ await user.click(within(listbox).getByRole('option', { name: 'workflow.nodes.triggerSchedule.frequency.weekly' }))await waitFor(() => {expect(onChange).toHaveBeenCalledWith('weekly')diff --git a/web/app/components/workflow/panel/chat-variable-panel/components/__tests__/variable-modal.spec.tsx b/web/app/components/workflow/panel/chat-variable-panel/components/__tests__/variable-modal.spec.tsxindex 319e3803f4f..297b534a6a2 100644--- a/web/app/components/workflow/panel/chat-variable-panel/components/__tests__/variable-modal.spec.tsx+++ b/web/app/components/workflow/panel/chat-variable-panel/components/__tests__/variable-modal.spec.tsx@@ -150,7 +150,7 @@ describe('variable-modal', () => {await user.click(screen.getByText('workflow.chatVariable.modal.editInJSON'))await waitFor(() => {- expect(screen.getByText('Loading...')).toBeInTheDocument()+ expect(screen.getByTestId('monaco-editor')).toBeInTheDocument()})await user.click(screen.getByText('workflow.chatVariable.modal.editInForm'))expect(screen.getByDisplayValue('enabled')).toBeInTheDocument()diff --git a/web/docs/test.md b/web/docs/test.mdindex cb22b73b151..bc1546a991a 100644--- a/web/docs/test.md+++ b/web/docs/test.md@@ -8,7 +8,7 @@ When I ask you to write/refactor/fix tests, follow these rules by default.- **Framework**: Next.js 15 + React 19 + TypeScript- **Testing Tools**: Vitest 4.0.16 + React Testing Library 16.0-- **Test Environment**: jsdom+- **Test Environment**: happy-dom- **File Naming**: `ComponentName.spec.tsx` inside a same-level `__tests__/` directory- **Placement Rule**: Component, hook, and utility tests must live in a sibling `__tests__/` folder at the same level as the source under test. For example, `foo/index.tsx` maps to `foo/__tests__/index.spec.tsx`, and `foo/bar.ts` maps to `foo/__tests__/bar.spec.ts`.@@ -30,7 +30,7 @@ pnpm test path/to/file.spec.tsx## Project Test Setup-- **Configuration**: `vitest.config.ts` sets the `jsdom` environment, loads the Testing Library presets, and respects our path aliases (`@/...`). Check this file before adding new transformers or module name mappers.+- **Configuration**: `vite.config.ts` sets the `happy-dom` environment, loads the Testing Library presets, and respects our path aliases (`@/...`). Check this file before adding new transformers or module name mappers.- **Global setup**: `vitest.setup.ts` already imports `@testing-library/jest-dom`, runs `cleanup()` after every test, and defines shared mocks (for example `react-i18next`). Add any environment-level mocks (for example `ResizeObserver`, `matchMedia`, `IntersectionObserver`, `TextEncoder`, `crypto`) here so they are shared consistently.- **Reusable mocks**: Place shared mock factories inside `web/__mocks__/` and use `vi.mock('module-name')` to point to them rather than redefining mocks in every spec.- **Mocking behavior**: Modules are not mocked automatically. Use `vi.mock(...)` in tests, or place global mocks in `vitest.setup.ts`.diff --git a/web/package.json b/web/package.jsonindex 361f8e2e0e7..76cfac4eba2 100644--- a/web/package.json+++ b/web/package.json@@ -220,11 +220,10 @@"eslint-plugin-react-refresh": "0.5.2","eslint-plugin-sonarjs": "4.0.2","eslint-plugin-storybook": "10.3.1",+ "happy-dom": "20.8.8","hono": "4.12.8","husky": "9.1.7","iconify-import-svg": "0.1.2",- "jsdom": "29.0.1",- "jsdom-testing-mocks": "1.16.0","knip": "6.0.2","lint-staged": "16.4.0","postcss": "8.5.8",diff --git a/web/plugins/dev-proxy/server.spec.ts b/web/plugins/dev-proxy/server.spec.tsindex 9c950abae01..c57ec8b4feb 100644--- a/web/plugins/dev-proxy/server.spec.ts+++ b/web/plugins/dev-proxy/server.spec.ts@@ -1,3 +1,6 @@+/**+ * @vitest-environment node+ */import { beforeEach, describe, expect, it, vi } from 'vitest'import { buildUpstreamUrl, createDevProxyApp, isAllowedDevOrigin, resolveDevProxyTargets } from './server'diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yamlindex 191826d80d9..8fd930e2b81 100644--- a/web/pnpm-lock.yaml+++ b/web/pnpm-lock.yaml@@ -371,7 +371,7 @@ importers:devDependencies:'@antfu/eslint-config':specifier: 7.7.3- version: 7.7.3(@eslint-react/[email protected]([email protected]([email protected]))([email protected]))(@next/[email protected])(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))(@typescript-eslint/[email protected]([email protected]))(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))(@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))(@vue/[email protected])([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected]([email protected]))([email protected])+ version: 7.7.3(@eslint-react/[email protected]([email protected]([email protected]))([email protected]))(@next/[email protected])(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))(@typescript-eslint/[email protected]([email protected]))(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))(@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))(@vue/[email protected])([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected]([email protected]))([email protected])'@chromatic-com/storybook':specifier: 5.0.2version: 5.0.2([email protected](@testing-library/[email protected])([email protected]([email protected]))([email protected]))@@ -506,7 +506,7 @@ importers:version: 0.5.21(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))([email protected]([email protected]([email protected]))([email protected])([email protected]([email protected])([email protected])))([email protected])'@vitest/coverage-v8':specifier: 4.1.0- version: 4.1.0(@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))+ version: 4.1.0(@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))agentation:specifier: 2.3.3@@ -546,6 +546,9 @@ importers:eslint-plugin-storybook:specifier: 10.3.1version: 10.3.1([email protected]([email protected]))([email protected](@testing-library/[email protected])([email protected]([email protected]))([email protected]))([email protected])+ happy-dom:+ specifier: 20.8.8+ version: 20.8.8hono:specifier: 4.12.8version: 4.12.8@@ -555,12 +558,6 @@ importers:iconify-import-svg:specifier: 0.1.2version: 0.1.2- jsdom:- specifier: 29.0.1- version: 29.0.1([email protected])- jsdom-testing-mocks:- specifier: 1.16.0- version: 1.16.0knip:specifier: 6.0.2version: 6.0.2@@ -608,13 +605,13 @@ importers:version: 11.3.3(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))vite-plus:specifier: 0.1.13- version: 0.1.13(@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])+ version: 0.1.13(@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])vitest:specifier: npm:@voidzero-dev/[email protected]- version: '@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])'+ version: '@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])'vitest-canvas-mock:specifier: 1.1.3- version: 1.1.3(@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))+ version: 1.1.3(@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))packages:@@ -3510,6 +3507,12 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==}+ '@types/[email protected]':+ resolution: {integrity: sha512-c2AKvDT8ToxLIOUlN51gTiHXflsfIFisS4pO7pDPoKouJCESkhZnEy623gwP9laCy5lnLDAw1vAzu2vM2YLOrA==}++ '@types/[email protected]':+ resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==}+'@types/[email protected]':resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==}@@ -4082,9 +4085,6 @@ packages:engines: {node: '>=6.0.0'}hasBin: true- resolution: {integrity: sha512-gbIqZ/eslnUFC1tjEvtz0sgx+xTK20wDnYMIA27VA04R7w6xxXQPZDbibjA9DTWZRA2CXtwHykkVzlCaAJAZig==}-resolution: {integrity: sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==}@@ -4385,9 +4385,6 @@ packages:resolution: {integrity: sha512-3O5QdqgFRUbXvK1x5INf1YkBz1UKSWqrd63vWsum8MNHDBYD5urm3QtxZbKU259OrEXNM26lP/MPY3d1IGkBgA==}engines: {node: '>=16'}- resolution: {integrity: sha512-COtn4EROW5dBGlE/4PiKnh6rZpAPxDeFLaEEwt4i10jpDMFt2EhQGS79QmmrO+iKCHv0PU/HrOWEhijFd1x99Q==}-resolution: {integrity: sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==}@@ -5359,6 +5356,10 @@ packages:resolution: {integrity: sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg==}+ resolution: {integrity: sha512-5/F8wxkNxYtsN0bXfMwIyNLZ9WYsoOYPbmoluqVJqv8KBUbcyKZawJ7uYK4WTX8IHBLYv+VXIwfeNDPy1oKMwQ==}+ engines: {node: '>=20.0.0'}+resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}engines: {node: '>=8'}@@ -5690,10 +5691,6 @@ packages:resolution: {integrity: sha512-/2uqY7x6bsrpi3i9LVU6J89352C0rpMk0as8trXxCtvd4kPk1ke/Eyif6wqfSLvoNJqcDG9Vk4UsXgygzCt2xA==}engines: {node: '>=20.0.0'}- resolution: {integrity: sha512-wLrulXiLpjmcUYOYGEvz4XARkrmdVpyxzdBl9IAMbQ+ib2/UhUTRCn49McdNfXLff2ysGBUms49ZKX0LR1Q0gg==}- engines: {node: '>=14'}-resolution: {integrity: sha512-z6JOK5gRO7aMybVq/y/MlIpKh8JIi68FBKMUtKkK2KH/wMSRlCxQ682d08LB9fYXplyY/UXG8P4XXTScmdjApg==}engines: {node: ^20.19.0 || ^22.13.0 || >=24.0.0}@@ -7841,6 +7838,10 @@ packages:engines: {node: '>=18'}deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation+ resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==}engines: {node: '>=18'}@@ -8140,7 +8141,7 @@ snapshots:idb: 8.0.0tslib: 2.8.1- '@antfu/[email protected](@eslint-react/[email protected]([email protected]([email protected]))([email protected]))(@next/[email protected])(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))(@typescript-eslint/[email protected]([email protected]))(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))(@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))(@vue/[email protected])([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected]([email protected]))([email protected])':+ '@antfu/[email protected](@eslint-react/[email protected]([email protected]([email protected]))([email protected]))(@next/[email protected])(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))(@typescript-eslint/[email protected]([email protected]))(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))(@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))(@vue/[email protected])([email protected]([email protected]([email protected])))([email protected]([email protected]([email protected])))([email protected]([email protected]))([email protected]([email protected]))([email protected])':dependencies:'@antfu/install-pkg': 1.1.0'@clack/prompts': 1.1.0@@ -8150,7 +8151,7 @@ snapshots:'@stylistic/eslint-plugin': 5.10.0([email protected]([email protected]))'@typescript-eslint/eslint-plugin': 8.57.1(@typescript-eslint/[email protected]([email protected]([email protected]))([email protected]))([email protected]([email protected]))([email protected])- '@vitest/eslint-plugin': 1.6.12(@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))([email protected])+ '@vitest/eslint-plugin': 1.6.12(@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))([email protected])ansis: 4.2.0cac: 7.0.0eslint: 10.1.0([email protected])@@ -8217,6 +8218,7 @@ snapshots:'@csstools/css-parser-algorithms': 4.0.0(@csstools/[email protected])'@csstools/css-tokenizer': 4.0.0lru-cache: 11.2.7+ optional: true'@asamuzakjp/[email protected]':dependencies:@@ -8225,8 +8227,10 @@ snapshots:css-tree: 3.2.1is-potential-custom-element-name: 1.0.1lru-cache: 11.2.7+ optional: true- '@asamuzakjp/[email protected]': {}+ '@asamuzakjp/[email protected]':+ optional: true'@babel/[email protected]':dependencies:@@ -8361,6 +8365,7 @@ snapshots:'@bramus/[email protected]':dependencies:css-tree: 3.2.1+ optional: true'@chevrotain/[email protected]':dependencies:@@ -8453,12 +8458,14 @@ snapshots:transitivePeerDependencies:- supports-color- '@csstools/[email protected]': {}+ '@csstools/[email protected]':+ optional: true'@csstools/[email protected](@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])':dependencies:'@csstools/css-parser-algorithms': 4.0.0(@csstools/[email protected])'@csstools/css-tokenizer': 4.0.0+ optional: true'@csstools/[email protected](@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])':dependencies:@@ -8466,16 +8473,20 @@ snapshots:'@csstools/css-calc': 3.1.1(@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])'@csstools/css-parser-algorithms': 4.0.0(@csstools/[email protected])'@csstools/css-tokenizer': 4.0.0+ optional: true'@csstools/[email protected](@csstools/[email protected])':dependencies:'@csstools/css-tokenizer': 4.0.0+ optional: true'@csstools/[email protected]([email protected])':optionalDependencies:css-tree: 3.2.1+ optional: true- '@csstools/[email protected]': {}+ '@csstools/[email protected]':+ optional: true'@e18e/[email protected]([email protected]([email protected]))([email protected]([email protected]))':dependencies:@@ -8777,7 +8788,8 @@ snapshots:'@eslint/core': 1.1.1levn: 0.4.1- '@exodus/[email protected]': {}+ '@exodus/[email protected]':+ optional: true'@floating-ui/[email protected]':dependencies:@@ -10814,6 +10826,12 @@ snapshots:'@types/[email protected]': {}+ '@types/[email protected]': {}++ '@types/[email protected]':+ dependencies:+ '@types/node': 25.5.0+'@types/[email protected]':dependencies:'@types/node': 25.5.0@@ -11019,7 +11037,7 @@ snapshots:optionalDependencies:react-server-dom-webpack: 19.2.4([email protected]([email protected]))([email protected])([email protected]([email protected])([email protected]))- '@vitest/[email protected](@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))':+ '@vitest/[email protected](@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))':dependencies:'@bcoe/v8-coverage': 1.0.2'@vitest/utils': 4.1.0@@ -11031,16 +11049,16 @@ snapshots:obug: 2.1.1std-env: 4.0.0tinyrainbow: 3.1.0- vitest: '@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])'+ vitest: '@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])'- '@vitest/[email protected](@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))([email protected])':+ '@vitest/[email protected](@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))([email protected])':dependencies:'@typescript-eslint/scope-manager': 8.57.1eslint: 10.1.0([email protected])optionalDependencies:typescript: 5.9.3- vitest: '@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])'+ vitest: '@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])'transitivePeerDependencies:- supports-color@@ -11105,7 +11123,7 @@ snapshots:'@voidzero-dev/[email protected]':optional: true- '@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])':+ '@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])':dependencies:'@standard-schema/spec': 1.1.0'@types/chai': 5.2.3@@ -11123,6 +11141,7 @@ snapshots:ws: 8.19.0optionalDependencies:'@types/node': 25.5.0+ happy-dom: 20.8.8jsdom: 29.0.1([email protected])transitivePeerDependencies:- '@arethetypeswrong/core'@@ -11419,11 +11438,10 @@ snapshots:- [email protected]: {}-dependencies:require-from-string: 2.0.2+ optional: true@@ -11715,8 +11733,6 @@ snapshots:- [email protected]: {}-dependencies:boolbase: 1.0.0@@ -11745,6 +11761,7 @@ snapshots:dependencies:mdn-data: 2.27.1source-map-js: 1.2.1+ optional: true@@ -11950,6 +11967,7 @@ snapshots:whatwg-url: 16.0.1transitivePeerDependencies:- '@noble/hashes'+ optional: true@@ -12897,6 +12915,18 @@ snapshots:+ dependencies:+ '@types/node': 25.5.0+ '@types/whatwg-mimetype': 3.0.2+ '@types/ws': 8.18.1+ entities: 7.0.1+ whatwg-mimetype: 3.0.0+ ws: 8.19.0+ transitivePeerDependencies:+ - bufferutil+ - utf-8-validate+@@ -13061,6 +13091,7 @@ snapshots:'@exodus/bytes': 1.15.0transitivePeerDependencies:- '@noble/hashes'+ optional: true@@ -13199,7 +13230,8 @@ snapshots:- [email protected]: {}+ optional: truedependencies:@@ -13261,11 +13293,6 @@ snapshots:- dependencies:- bezier-easing: 2.1.0- css-mediaquery: 0.1.2-dependencies:'@asamuzakjp/css-color': 5.0.1@@ -13293,6 +13320,7 @@ snapshots:canvas: 3.2.2transitivePeerDependencies:- '@noble/hashes'+ optional: true@@ -13753,7 +13781,8 @@ snapshots:- [email protected]: {}+ optional: true@@ -15121,6 +15150,7 @@ snapshots:dependencies:xmlchars: 2.2.0+ optional: true@@ -15397,7 +15427,8 @@ snapshots:picocolors: 1.1.1sax: 1.6.0- [email protected]: {}+ optional: truedependencies:@@ -15559,10 +15590,12 @@ snapshots:dependencies:tldts: 7.0.27+ optional: truedependencies:punycode: 2.3.1+ optional: true@@ -15655,7 +15688,8 @@ snapshots:- [email protected]: {}+ optional: truedependencies:@@ -15879,11 +15913,11 @@ snapshots:- supports-color- typescript- [email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]):+ [email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected]):dependencies:'@oxc-project/types': 0.120.0'@voidzero-dev/vite-plus-core': 0.1.13(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])- '@voidzero-dev/vite-plus-test': 0.1.13(@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])+ '@voidzero-dev/vite-plus-test': 0.1.13(@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])cac: 7.0.0cross-spawn: 7.0.6oxfmt: 0.41.0@@ -15950,11 +15984,11 @@ snapshots:optionalDependencies:vite: '@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])'- [email protected](@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])):+ [email protected](@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])):dependencies:cssfontparser: 1.2.1moo-color: 1.0.3- vitest: '@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])'+ vitest: '@voidzero-dev/[email protected](@types/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected])([email protected])([email protected])([email protected])([email protected])'@@ -15990,6 +16024,7 @@ snapshots:dependencies:xml-name-validator: 5.0.0+ optional: true@@ -16002,7 +16037,8 @@ snapshots:- [email protected]: {}+ optional: true@@ -16044,9 +16080,12 @@ snapshots:dependencies:iconv-lite: 0.6.3+ [email protected]: {}+- [email protected]: {}+ optional: truedependencies:@@ -16055,6 +16094,7 @@ snapshots:webidl-conversions: 8.0.1transitivePeerDependencies:- '@noble/hashes'+ optional: truedependencies:@@ -16078,9 +16118,11 @@ snapshots:- [email protected]: {}+ optional: true- [email protected]: {}+ optional: truediff --git a/web/vite.config.ts b/web/vite.config.tsindex 617cae9ab54..28746f81ca3 100644--- a/web/vite.config.ts+++ b/web/vite.config.ts@@ -75,7 +75,8 @@ export default defineConfig(({ mode }) => {// Vitest configtest: {- environment: 'jsdom',+ pool: 'threads',+ environment: 'happy-dom',globals: true,setupFiles: ['./vitest.setup.ts'],coverage: {diff --git a/web/vitest.setup.ts b/web/vitest.setup.tsindex e63ea2b54eb..ac26ac5d25e 100644--- a/web/vitest.setup.ts+++ b/web/vitest.setup.ts@@ -1,14 +1,8 @@import { act, cleanup } from '@testing-library/react'-import { mockAnimationsApi, mockResizeObserver } from 'jsdom-testing-mocks'import * as React from 'react'import '@testing-library/jest-dom/vitest'import 'vitest-canvas-mock'-mockResizeObserver()--// Mock Web Animations API for Headless UI-mockAnimationsApi()-// Suppress act() warnings from @headlessui/react internal Transition component// These warnings are caused by Headless UI's internal async state updates, not our codeconst originalConsoleError = console.error@@ -77,24 +71,10 @@ if (typeof globalThis.IntersectionObserver === 'undefined') {}}-// Mock Element.scrollIntoView for tests (not available in happy-dom/jsdom)-if (typeof Element !== 'undefined' && !Element.prototype.scrollIntoView)- Element.prototype.scrollIntoView = function () { /* noop */ }--// Mock DOMRect.fromRect for tests (not available in jsdom)-if (typeof DOMRect !== 'undefined' && typeof (DOMRect as typeof DOMRect & { fromRect?: unknown }).fromRect !== 'function') {- (DOMRect as typeof DOMRect & { fromRect: (rect?: DOMRectInit) => DOMRect }).fromRect = (rect = {}) => new DOMRect(- rect.x ?? 0,- rect.y ?? 0,- rect.width ?? 0,- rect.height ?? 0,- )-}-afterEach(async () => {// Wrap cleanup in act() to flush pending React scheduler work// This prevents "window is not defined" errors from React 19's scheduler- // which uses setImmediate/MessageChannel that can fire after jsdom cleanup+ // which uses setImmediate/MessageChannel that can fire after DOM cleanupawait act(async () => {cleanup()})@@ -131,19 +111,97 @@ vi.mock('@floating-ui/react', async () => {}})-// mock window.matchMedia-Object.defineProperty(window, 'matchMedia', {- writable: true,- value: vi.fn().mockImplementation(query => ({- matches: false,- media: query,- onchange: null,- addListener: vi.fn(), // deprecated- removeListener: vi.fn(), // deprecated- addEventListener: vi.fn(),- removeEventListener: vi.fn(),- dispatchEvent: vi.fn(),- })),+vi.mock('@monaco-editor/react', () => {+ const createEditorMock = () => {+ const focusListeners: Array<() => void> = []+ const blurListeners: Array<() => void> = []++ return {+ getContentHeight: vi.fn(() => 56),+ onDidFocusEditorText: vi.fn((listener: () => void) => {+ focusListeners.push(listener)+ return { dispose: vi.fn() }+ }),+ onDidBlurEditorText: vi.fn((listener: () => void) => {+ blurListeners.push(listener)+ return { dispose: vi.fn() }+ }),+ layout: vi.fn(),+ getAction: vi.fn(() => ({ run: vi.fn() })),+ getModel: vi.fn(() => ({+ getLineContent: vi.fn(() => ''),+ })),+ getPosition: vi.fn(() => ({ lineNumber: 1, column: 1 })),+ deltaDecorations: vi.fn(() => []),+ focus: vi.fn(() => {+ focusListeners.forEach(listener => listener())+ }),+ setPosition: vi.fn(),+ revealLine: vi.fn(),+ trigger: vi.fn(),+ __blur: () => {+ blurListeners.forEach(listener => listener())+ },+ }+ }++ const monacoMock = {+ editor: {+ setTheme: vi.fn(),+ defineTheme: vi.fn(),+ },+ Range: class {+ startLineNumber: number+ startColumn: number+ endLineNumber: number+ endColumn: number+ constructor(startLineNumber: number, startColumn: number, endLineNumber: number, endColumn: number) {+ this.startLineNumber = startLineNumber+ this.startColumn = startColumn+ this.endLineNumber = endLineNumber+ this.endColumn = endColumn+ }+ },+ }++ const MonacoEditor = ({+ value = '',+ onChange,+ onMount,+ options,+ }: {+ value?: string+ onChange?: (value: string | undefined) => void+ onMount?: (editor: ReturnType<typeof createEditorMock>, monaco: typeof monacoMock) => void+ options?: { readOnly?: boolean }+ }) => {+ const editorRef = React.useRef<ReturnType<typeof createEditorMock> | null>(null)+ if (!editorRef.current)+ editorRef.current = createEditorMock()++ React.useEffect(() => {+ onMount?.(editorRef.current!, monacoMock)+ }, [onMount])++ return React.createElement('textarea', {+ 'data-testid': 'monaco-editor',+ 'readOnly': options?.readOnly,+ value,+ 'onChange': (event: React.ChangeEvent<HTMLTextAreaElement>) => onChange?.(event.target.value),+ 'onFocus': () => editorRef.current?.focus(),+ 'onBlur': () => editorRef.current?.__blur(),+ })+ }++ return {+ __esModule: true,+ default: MonacoEditor,+ Editor: MonacoEditor,+ loader: {+ config: vi.fn(),+ init: vi.fn().mockResolvedValue(monacoMock),+ },+ }})// Mock localStorage for testing