#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
Speed up frontend tests (#8423)
James Brunton7d09d4d7401a
diff --git a/frontend/.gitignore b/frontend/.gitignoreindex e4083a6a53..2a3529eb1d 100644--- a/frontend/.gitignore+++ b/frontend/.gitignore@@ -7,6 +7,7 @@# testing/coverage+/editor/coverage# production/builddiff --git a/frontend/editor/src/core/components/easterEgg/brickGame/brickGameGeometry.test.ts b/frontend/editor/src/core/components/easterEgg/brickGame/brickGameGeometry.test.tsindex 2cdfac8507..dd1c15c254 100644--- a/frontend/editor/src/core/components/easterEgg/brickGame/brickGameGeometry.test.ts+++ b/frontend/editor/src/core/components/easterEgg/brickGame/brickGameGeometry.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {type Box,diff --git a/frontend/editor/src/core/components/filesPage/fileOrigin.test.ts b/frontend/editor/src/core/components/filesPage/fileOrigin.test.tsindex 0157fc7513..525f1abe63 100644--- a/frontend/editor/src/core/components/filesPage/fileOrigin.test.ts+++ b/frontend/editor/src/core/components/filesPage/fileOrigin.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { isUnfiledLocalFile } from "@app/components/filesPage/fileOrigin";import type { StirlingFileStub } from "@app/types/fileContext";diff --git a/frontend/editor/src/core/components/pageTracks/trackFileKind.test.ts b/frontend/editor/src/core/components/pageTracks/trackFileKind.test.tsindex 7608943321..9af49384c1 100644--- a/frontend/editor/src/core/components/pageTracks/trackFileKind.test.ts+++ b/frontend/editor/src/core/components/pageTracks/trackFileKind.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {diff --git a/frontend/editor/src/core/components/pageTracks/trackWorkspaceReducer.test.ts b/frontend/editor/src/core/components/pageTracks/trackWorkspaceReducer.test.tsindex 094e7d3f37..8319d4d332 100644--- a/frontend/editor/src/core/components/pageTracks/trackWorkspaceReducer.test.ts+++ b/frontend/editor/src/core/components/pageTracks/trackWorkspaceReducer.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { FileId } from "@app/types/file";diff --git a/frontend/editor/src/core/components/shared/superSearch/superSearchFilters.test.ts b/frontend/editor/src/core/components/shared/superSearch/superSearchFilters.test.tsindex a8637952f9..e975625ae5 100644--- a/frontend/editor/src/core/components/shared/superSearch/superSearchFilters.test.ts+++ b/frontend/editor/src/core/components/shared/superSearch/superSearchFilters.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {parseSuperSearchQuery,diff --git a/frontend/editor/src/core/components/shared/updatePopupGate.test.ts b/frontend/editor/src/core/components/shared/updatePopupGate.test.tsindex a34d823cd2..0cc44db15e 100644--- a/frontend/editor/src/core/components/shared/updatePopupGate.test.ts+++ b/frontend/editor/src/core/components/shared/updatePopupGate.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { isUpdatePopupAllowed } from "@app/components/shared/updatePopupGate";diff --git a/frontend/editor/src/core/components/viewer/commentsSidebarOrder.test.ts b/frontend/editor/src/core/components/viewer/commentsSidebarOrder.test.tsindex 98d55d9a90..fce6ee3085 100644--- a/frontend/editor/src/core/components/viewer/commentsSidebarOrder.test.ts+++ b/frontend/editor/src/core/components/viewer/commentsSidebarOrder.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { compareEntriesByVisualOrder } from "@app/components/viewer/commentsSidebarOrder";diff --git a/frontend/editor/src/core/components/viewer/readAloudHighlight.test.ts b/frontend/editor/src/core/components/viewer/readAloudHighlight.test.tsindex cf2ca9a764..9de8fad772 100644--- a/frontend/editor/src/core/components/viewer/readAloudHighlight.test.ts+++ b/frontend/editor/src/core/components/viewer/readAloudHighlight.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { computeReadAloudHighlightRect } from "@app/components/viewer/readAloudHighlight";diff --git a/frontend/editor/src/core/components/viewer/viewerPanConfig.test.ts b/frontend/editor/src/core/components/viewer/viewerPanConfig.test.tsindex 99c944cb0e..3663ba43f8 100644--- a/frontend/editor/src/core/components/viewer/viewerPanConfig.test.ts+++ b/frontend/editor/src/core/components/viewer/viewerPanConfig.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { PanPluginPackage } from "@embedpdf/plugin-pan";import { initialState as interactionManagerInitialState } from "@embedpdf/plugin-interaction-manager";diff --git a/frontend/editor/src/core/contexts/file/addFiles.bulkImport.test.ts b/frontend/editor/src/core/contexts/file/addFiles.bulkImport.test.tsindex d28874d980..54c605d24c 100644--- a/frontend/editor/src/core/contexts/file/addFiles.bulkImport.test.ts+++ b/frontend/editor/src/core/contexts/file/addFiles.bulkImport.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, describe, expect, test, vi } from "vitest";import type { FileContextState } from "@app/types/fileContext";import type { FileId } from "@app/types/file";diff --git a/frontend/editor/src/core/contexts/file/lifecycle.test.ts b/frontend/editor/src/core/contexts/file/lifecycle.test.tsindex eee69c0875..397d9be479 100644--- a/frontend/editor/src/core/contexts/file/lifecycle.test.ts+++ b/frontend/editor/src/core/contexts/file/lifecycle.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, describe, expect, it, vi } from "vitest";import { FileLifecycleManager } from "@app/contexts/file/lifecycle";import type { FileId } from "@app/types/file";diff --git a/frontend/editor/src/core/contexts/file/storedFileReconciler.test.ts b/frontend/editor/src/core/contexts/file/storedFileReconciler.test.tsindex 3db0decfc1..74f9262d95 100644--- a/frontend/editor/src/core/contexts/file/storedFileReconciler.test.ts+++ b/frontend/editor/src/core/contexts/file/storedFileReconciler.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import type { StirlingFileStub } from "@app/types/fileContext";import type { FileId } from "@app/types/file";diff --git a/frontend/editor/src/core/data/settingsContentSearch.test.ts b/frontend/editor/src/core/data/settingsContentSearch.test.tsindex 3a46d129d7..7d94392569 100644--- a/frontend/editor/src/core/data/settingsContentSearch.test.ts+++ b/frontend/editor/src/core/data/settingsContentSearch.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test } from "vitest";import { flattenTranslationStrings } from "@app/data/settingsContentSearch";diff --git a/frontend/editor/src/core/data/settingsSectionTargets.test.ts b/frontend/editor/src/core/data/settingsSectionTargets.test.tsindex 913d3ef122..6a6291b3d2 100644--- a/frontend/editor/src/core/data/settingsSectionTargets.test.ts+++ b/frontend/editor/src/core/data/settingsSectionTargets.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { BASE_SECTION_ALIASES } from "@app/data/settingsAliases";import { SETTINGS_SEARCH_INDEX } from "@app/data/settingsSearchIndex";diff --git a/frontend/editor/src/core/docs/manifest/transform.test.ts b/frontend/editor/src/core/docs/manifest/transform.test.tsindex 1dac40b377..302280df76 100644--- a/frontend/editor/src/core/docs/manifest/transform.test.ts+++ b/frontend/editor/src/core/docs/manifest/transform.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {buildManifest,diff --git a/frontend/editor/src/core/env.test.ts b/frontend/editor/src/core/env.test.tsindex 19566db8c5..24508ce960 100644--- a/frontend/editor/src/core/env.test.ts+++ b/frontend/editor/src/core/env.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { readFileSync, readdirSync } from "fs";import { join, extname } from "path";import { fileURLToPath } from "url";diff --git a/frontend/editor/src/core/hooks/tools/adjustPageScale/useAdjustPageScaleOperation.test.ts b/frontend/editor/src/core/hooks/tools/adjustPageScale/useAdjustPageScaleOperation.test.tsindex 7453ecfb3e..1d80ec17a7 100644--- a/frontend/editor/src/core/hooks/tools/adjustPageScale/useAdjustPageScaleOperation.test.ts+++ b/frontend/editor/src/core/hooks/tools/adjustPageScale/useAdjustPageScaleOperation.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it, test } from "vitest";import {adjustPageScaleFromApiParams,diff --git a/frontend/editor/src/core/hooks/tools/crop/useCropParameters.test.ts b/frontend/editor/src/core/hooks/tools/crop/useCropParameters.test.tsindex e1e784b116..2f9f39b553 100644--- a/frontend/editor/src/core/hooks/tools/crop/useCropParameters.test.ts+++ b/frontend/editor/src/core/hooks/tools/crop/useCropParameters.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test } from "vitest";import {defaultParameters,diff --git a/frontend/editor/src/core/hooks/tools/shared/toolApiMapping.test.ts b/frontend/editor/src/core/hooks/tools/shared/toolApiMapping.test.tsindex f3443dfb51..ba3ae8df7f 100644--- a/frontend/editor/src/core/hooks/tools/shared/toolApiMapping.test.ts+++ b/frontend/editor/src/core/hooks/tools/shared/toolApiMapping.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test } from "vitest";import {isToolEndpoint,diff --git a/frontend/editor/src/core/hooks/tools/validateSignature/utils/signatureStatus.test.ts b/frontend/editor/src/core/hooks/tools/validateSignature/utils/signatureStatus.test.tsindex e1c621686e..54b473dcf8 100644--- a/frontend/editor/src/core/hooks/tools/validateSignature/utils/signatureStatus.test.ts+++ b/frontend/editor/src/core/hooks/tools/validateSignature/utils/signatureStatus.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test } from "vitest";import type { TFunction } from "i18next";import { computeSignatureStatus } from "@app/hooks/tools/validateSignature/utils/signatureStatus";diff --git a/frontend/editor/src/core/hooks/useConnectedServer.test.ts b/frontend/editor/src/core/hooks/useConnectedServer.test.tsindex fde07f8bb4..8dfa478324 100644--- a/frontend/editor/src/core/hooks/useConnectedServer.test.ts+++ b/frontend/editor/src/core/hooks/useConnectedServer.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { useConnectedServer } from "@app/hooks/useConnectedServer";diff --git a/frontend/editor/src/core/hooks/useLogoAssets.test.ts b/frontend/editor/src/core/hooks/useLogoAssets.test.tsindex 7dc29fdcc7..314de68918 100644--- a/frontend/editor/src/core/hooks/useLogoAssets.test.ts+++ b/frontend/editor/src/core/hooks/useLogoAssets.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test } from "vitest";import * as fs from "fs";import * as path from "path";diff --git a/frontend/editor/src/core/hooks/useServerProcessingBlock.test.ts b/frontend/editor/src/core/hooks/useServerProcessingBlock.test.tsindex 9544a39222..4858bbca9b 100644--- a/frontend/editor/src/core/hooks/useServerProcessingBlock.test.ts+++ b/frontend/editor/src/core/hooks/useServerProcessingBlock.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { useServerProcessingBlock } from "@app/hooks/useServerProcessingBlock";diff --git a/frontend/editor/src/core/hooks/useSuperSearch.test.ts b/frontend/editor/src/core/hooks/useSuperSearch.test.tsindex 0f1f573e8b..e6653a8d22 100644--- a/frontend/editor/src/core/hooks/useSuperSearch.test.ts+++ b/frontend/editor/src/core/hooks/useSuperSearch.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport React from "react";import { describe, expect, it, vi } from "vitest";diff --git a/frontend/editor/src/core/i18n/languages.test.ts b/frontend/editor/src/core/i18n/languages.test.tsindex 1056e48a90..85172f843c 100644--- a/frontend/editor/src/core/i18n/languages.test.ts+++ b/frontend/editor/src/core/i18n/languages.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport fs from "node:fs";import path from "node:path";import { fileURLToPath } from "node:url";diff --git a/frontend/editor/src/core/pages/HomePage.startupView.test.tsx b/frontend/editor/src/core/pages/HomePage.startupView.test.tsxindex 93b1d32113..c8885ed586 100644--- a/frontend/editor/src/core/pages/HomePage.startupView.test.tsx+++ b/frontend/editor/src/core/pages/HomePage.startupView.test.tsx@@ -1,13 +1,7 @@import "fake-indexeddb/auto";import { useState } from "react";-import {- act,- fireEvent,- render,- screen,- waitFor,-} from "@testing-library/react";-import { beforeEach, describe, expect, it, vi } from "vitest";+import { act, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import { MemoryRouter, useLocation, useNavigate } from "react-router-dom";import { MantineProvider } from "@mantine/core";import { AppProviders } from "@app/components/AppProviders";@@ -94,14 +88,24 @@ function renderApp(late = false) {}async function expectSettledInReader() {- await waitFor(() => expect(seen.pathname).toBe("/reader"));+ await vi.waitFor(() => expect(seen.pathname).toBe("/reader"));// Settled there, not just passing through on the way back to the editor.- await act(() => new Promise((r) => setTimeout(r, 1000)));+ await act(() => vi.advanceTimersByTimeAsync(1000));expect(seen).toEqual({ pathname: "/reader", readerMode: true });}describe("default startup view: Reader", () => {beforeEach(() => {+ // setImmediate stays real: React's scheduler and fake-indexeddb run on it.+ vi.useFakeTimers({+ toFake: [+ "setTimeout",+ "clearTimeout",+ "setInterval",+ "clearInterval",+ "Date",+ ],+ });// The full provider tree settles asynchronously outside act().allowConsole.error(/not wrapped in act/);localStorage.clear();@@ -111,6 +115,10 @@ describe("default startup view: Reader", () => {);});+ afterEach(() => {+ vi.useRealTimers();+ });+it.each([["with the providers", false],["after the providers", true],@@ -119,7 +127,7 @@ describe("default startup view: Reader", () => {async (_label, late) => {renderApp(late);if (late) {- await waitFor(() => expect(seen.readerMode).toBe(true));+ await vi.waitFor(() => expect(seen.readerMode).toBe(true));act(() => showPage());}await expectSettledInReader();@@ -133,7 +141,7 @@ describe("default startup view: Reader", () => {.mockReturnValue([{ type: "reload" } as PerformanceNavigationTiming]);try {renderApp();- await act(() => new Promise((r) => setTimeout(r, 1500)));+ await act(() => vi.advanceTimersByTimeAsync(1500));expect(seen).toEqual({ pathname: "/", readerMode: false });} finally {navigation.mockRestore();@@ -144,7 +152,7 @@ describe("default startup view: Reader", () => {renderApp();await expectSettledInReader();act(() => backToTools());- await waitFor(() =>+ await vi.waitFor(() =>expect(seen).toEqual({ pathname: "/", readerMode: false }),);fireEvent.click(document.querySelector(".quick-nav-brand-button")!);@@ -155,7 +163,7 @@ describe("default startup view: Reader", () => {renderApp();await expectSettledInReader();act(() => selectTool("compress"));- await waitFor(() =>+ await vi.waitFor(() =>expect(seen).toEqual({ pathname: "/compress", readerMode: false }),);@@ -163,7 +171,7 @@ describe("default startup view: Reader", () => {await expectSettledInReader();act(() => goBack());- await waitFor(() =>+ await vi.waitFor(() =>expect(seen).toEqual({ pathname: "/compress", readerMode: false }),);}, 15000);@@ -172,9 +180,9 @@ describe("default startup view: Reader", () => {renderApp();await expectSettledInReader();act(() => backToTools());- await waitFor(() => expect(seen.readerMode).toBe(false));+ await vi.waitFor(() => expect(seen.readerMode).toBe(false));act(() => goToSettings());- await waitFor(() => expect(seen.pathname).toBe("/settings/general"));+ await vi.waitFor(() => expect(seen.pathname).toBe("/settings/general"));fireEvent.click(document.querySelector(".quick-nav-brand-button")!);await expectSettledInReader();@@ -184,7 +192,7 @@ describe("default startup view: Reader", () => {renderApp();await expectSettledInReader();act(() => selectTool("compress"));- await waitFor(() =>+ await vi.waitFor(() =>expect(seen).toEqual({ pathname: "/compress", readerMode: false }),);@@ -203,7 +211,7 @@ describe("default startup view: Reader", () => {renderApp();await expectSettledInReader();act(() => selectTool("multiTool"));- await waitFor(() => {+ await vi.waitFor(() => {expect(seen).toEqual({ pathname: "/multi-tool", readerMode: false });expect(navigation.workbench).toBe("pageEditor");});@@ -222,14 +230,16 @@ describe("default startup view: Reader", () => {}fireEvent.click(document.querySelector(".quick-nav-brand-button")!);- await waitFor(() => expect(navigation.showNavigationWarning).toBe(true));+ await vi.waitFor(() =>+ expect(navigation.showNavigationWarning).toBe(true),+ );expect(seen).toEqual({ pathname: "/multi-tool", readerMode: false });expect(navigation.selectedTool).toBe("multiTool");expect(navigation.workbench).toBe("pageEditor");if (decision === "cancel") {fireEvent.click(screen.getByRole("button", { name: "keepWorking" }));- await waitFor(() =>+ await vi.waitFor(() =>expect(navigation.showNavigationWarning).toBe(false),);expect(seen).toEqual({ pathname: "/multi-tool", readerMode: false });diff --git a/frontend/editor/src/core/services/__tests__/copyBlobBytes.test.ts b/frontend/editor/src/core/services/__tests__/copyBlobBytes.test.tsindex 432b7f302a..3433fe9873 100644--- a/frontend/editor/src/core/services/__tests__/copyBlobBytes.test.ts+++ b/frontend/editor/src/core/services/__tests__/copyBlobBytes.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { afterEach, describe, expect, test, vi } from "vitest";import { copyBlobBytes } from "@app/services/fileStorage";diff --git a/frontend/editor/src/core/services/diskLinkState.test.ts b/frontend/editor/src/core/services/diskLinkState.test.tsindex 524c2c82ae..a8c486b465 100644--- a/frontend/editor/src/core/services/diskLinkState.test.ts+++ b/frontend/editor/src/core/services/diskLinkState.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import { diskLinkState } from "@app/services/diskLinkState";diff --git a/frontend/editor/src/core/services/fileStorage.migration.test.ts b/frontend/editor/src/core/services/fileStorage.migration.test.tsindex 796e4f856b..e8bd324826 100644--- a/frontend/editor/src/core/services/fileStorage.migration.test.ts+++ b/frontend/editor/src/core/services/fileStorage.migration.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {legacyDerivedFromTool,diff --git a/frontend/editor/src/core/services/fileStorage.thumbnailTtl.test.ts b/frontend/editor/src/core/services/fileStorage.thumbnailTtl.test.tsindex 337df8c730..4bf9ac9801 100644--- a/frontend/editor/src/core/services/fileStorage.thumbnailTtl.test.ts+++ b/frontend/editor/src/core/services/fileStorage.thumbnailTtl.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { shouldBumpThumbnailTtl } from "@app/services/fileStorage";diff --git a/frontend/editor/src/core/services/pdfiumFontFallback.test.ts b/frontend/editor/src/core/services/pdfiumFontFallback.test.tsindex df901957f2..b488d9fe6b 100644--- a/frontend/editor/src/core/services/pdfiumFontFallback.test.ts+++ b/frontend/editor/src/core/services/pdfiumFontFallback.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { FontCharset } from "@embedpdf/models";import { getLocalFontFallbackConfig } from "@app/services/pdfiumFontFallback";diff --git a/frontend/editor/src/core/services/pdfiumInit.test.ts b/frontend/editor/src/core/services/pdfiumInit.test.tsindex 3dbe08ac0e..bb18d71f90 100644--- a/frontend/editor/src/core/services/pdfiumInit.test.ts+++ b/frontend/editor/src/core/services/pdfiumInit.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test, vi } from "vitest";/**diff --git a/frontend/editor/src/core/services/pdfiumScanQueue.test.ts b/frontend/editor/src/core/services/pdfiumScanQueue.test.tsindex 1d5646405a..bf3f15fd3f 100644--- a/frontend/editor/src/core/services/pdfiumScanQueue.test.ts+++ b/frontend/editor/src/core/services/pdfiumScanQueue.test.ts@@ -1,3 +1,4 @@+// @vitest-environment node/*** Serialization contract of the main-thread PDFium scan queue: scans run in* submission order and one failing scan does not wedge the queue.diff --git a/frontend/editor/src/core/services/postLoginRedirect.test.ts b/frontend/editor/src/core/services/postLoginRedirect.test.tsindex c1240a7669..da79f07678 100644--- a/frontend/editor/src/core/services/postLoginRedirect.test.ts+++ b/frontend/editor/src/core/services/postLoginRedirect.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { isSafePostLoginRedirect } from "@app/services/postLoginRedirect";diff --git a/frontend/editor/src/core/services/unsavedWork.test.ts b/frontend/editor/src/core/services/unsavedWork.test.tsindex c83e7ee2d1..ff5732dbfa 100644--- a/frontend/editor/src/core/services/unsavedWork.test.ts+++ b/frontend/editor/src/core/services/unsavedWork.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect, vi, beforeEach, afterEach } from "vitest";import {registerUnsavedWorkChecker,diff --git a/frontend/editor/src/core/services/zipFileService.test.ts b/frontend/editor/src/core/services/zipFileService.test.tsindex 0d76ab9b0e..277be36f80 100644--- a/frontend/editor/src/core/services/zipFileService.test.ts+++ b/frontend/editor/src/core/services/zipFileService.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test } from "vitest";import { zipFileService } from "@app/services/zipFileService";diff --git a/frontend/editor/src/core/setupTests.ts b/frontend/editor/src/core/setupTests.tsindex 30153939e4..b003c59884 100644--- a/frontend/editor/src/core/setupTests.ts+++ b/frontend/editor/src/core/setupTests.ts@@ -46,7 +46,7 @@ class LocalStorageMock implements Storage {}}-Object.defineProperty(window, "localStorage", {+Object.defineProperty(globalThis, "localStorage", {value: new LocalStorageMock(),writable: true,});@@ -157,7 +157,7 @@ global.IntersectionObserver = vi.fn().mockImplementation(() => ({}));// Mock matchMedia for responsive components-Object.defineProperty(window, "matchMedia", {+Object.defineProperty(globalThis, "matchMedia", {writable: true,value: vi.fn().mockImplementation((query) => ({matches: false,diff --git a/frontend/editor/src/core/tests/failOnConsole.test.ts b/frontend/editor/src/core/tests/failOnConsole.test.tsindex 944917a14d..b3c9eda414 100644--- a/frontend/editor/src/core/tests/failOnConsole.test.ts+++ b/frontend/editor/src/core/tests/failOnConsole.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {allowConsole,diff --git a/frontend/editor/src/core/tests/translation.test.ts b/frontend/editor/src/core/tests/translation.test.tsindex 83f6935796..d35d174031 100644--- a/frontend/editor/src/core/tests/translation.test.ts+++ b/frontend/editor/src/core/tests/translation.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, test, expect } from "vitest";import fs from "fs";import path from "path";diff --git a/frontend/editor/src/core/tests/translationStructure.test.ts b/frontend/editor/src/core/tests/translationStructure.test.tsindex 1f61960358..0f79ba1bfc 100644--- a/frontend/editor/src/core/tests/translationStructure.test.ts+++ b/frontend/editor/src/core/tests/translationStructure.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, test, expect } from "vitest";import fs from "fs";import path from "path";diff --git a/frontend/editor/src/core/tests/unusedTranslations.test.ts b/frontend/editor/src/core/tests/unusedTranslations.test.tsindex e91c2f4485..b02a81a71e 100644--- a/frontend/editor/src/core/tests/unusedTranslations.test.ts+++ b/frontend/editor/src/core/tests/unusedTranslations.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport fs from "fs";import path from "path";import { describe, expect, test } from "vitest";diff --git a/frontend/editor/src/core/tools/formFill/radioLayout.test.ts b/frontend/editor/src/core/tools/formFill/radioLayout.test.tsindex 4a1cd9fb06..08343fafcd 100644--- a/frontend/editor/src/core/tools/formFill/radioLayout.test.ts+++ b/frontend/editor/src/core/tools/formFill/radioLayout.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { radioOptionRects } from "@app/tools/formFill/formCoordinateUtils";diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/BulletGrouping.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/BulletGrouping.test.tsindex aa2e050c72..b5aaceb117 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/BulletGrouping.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/BulletGrouping.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import { Page } from "@app/tools/pdfTextEditor/model/Page";import { TextRun } from "@app/tools/pdfTextEditor/model/TextRun";diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/Color.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/Color.test.tsindex 204dec5f38..4d33dec6cd 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/Color.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/Color.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {BLACK,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/DisplayTransform.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/DisplayTransform.test.tsindex bc8c4ac946..0480240d0e 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/DisplayTransform.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/DisplayTransform.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import type { WrappedPdfiumModule } from "@embedpdf/pdfium";import { DisplayTransform } from "@app/tools/pdfTextEditor/model/DisplayTransform";diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/LineGrouperSpacing.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/LineGrouperSpacing.test.tsindex 30ea3ff47b..1e280fde21 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/LineGrouperSpacing.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/LineGrouperSpacing.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import { Page } from "@app/tools/pdfTextEditor/model/Page";import { TextRun } from "@app/tools/pdfTextEditor/model/TextRun";diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/ParagraphEdit.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/ParagraphEdit.test.tsindex c1653f761f..4bb3c4694b 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/ParagraphEdit.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/ParagraphEdit.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {planParagraphEdit,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/ReplaceImageCommand.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/ReplaceImageCommand.test.tsindex ff432689f8..3dbe4842fd 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/ReplaceImageCommand.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/ReplaceImageCommand.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import { ReplaceImageCommand } from "@app/tools/pdfTextEditor/commands/ReplaceImageCommand";import { Page } from "@app/tools/pdfTextEditor/model/Page";diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/affine.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/affine.test.tsindex 6fff639295..bd0a00e54c 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/affine.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/affine.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {composeAffine,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/canvasBackground.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/canvasBackground.test.tsindex 90b420160b..ac5579b152 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/canvasBackground.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/canvasBackground.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {sampleRunBackground,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/cloneParagraphLineSlot.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/cloneParagraphLineSlot.test.tsindex 77d7595a2e..7eda081696 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/cloneParagraphLineSlot.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/cloneParagraphLineSlot.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {cloneParagraphLineSlot,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/exactLayout.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/exactLayout.test.tsindex cf8f6a9d2d..c63196b8a2 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/exactLayout.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/exactLayout.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {buildExactLines,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/externalImageEdit.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/externalImageEdit.test.tsindex b61d995b1a..1b8d25af38 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/externalImageEdit.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/externalImageEdit.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect, vi, beforeEach, afterEach } from "vitest";import { deflateSync, inflateSync } from "node:zlib";import {diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/fitText.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/fitText.test.tsindex 359c8b0662..89ce4063f8 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/fitText.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/fitText.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { fitTextToWidth, NO_FIT } from "@app/tools/pdfTextEditor/util/fitText";diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/fontFamily.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/fontFamily.test.tsindex 798ab1cb00..54f64464ab 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/fontFamily.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/fontFamily.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {flipBold,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/helveticaVariant.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/helveticaVariant.test.tsindex a109f5d30d..d6e99ef8d4 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/helveticaVariant.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/helveticaVariant.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import { helveticaVariantFor } from "@app/tools/pdfTextEditor/util/helveticaVariant";diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/pageFonts.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/pageFonts.test.tsindex f94e6e5691..08b460a881 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/pageFonts.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/pageFonts.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {analyzePageFonts,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/pdfRevision.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/pdfRevision.test.tsindex 98f7103fcb..a00f400eeb 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/pdfRevision.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/pdfRevision.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { fromLatin1, toLatin1 } from "@app/tools/pdfTextEditor/pdfdoc/bytes";import { RawPdf } from "@app/tools/pdfTextEditor/pdfdoc/raw";diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/pdfiumSaveGuards.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/pdfiumSaveGuards.test.tsindex d82414b7b9..78d35c749a 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/pdfiumSaveGuards.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/pdfiumSaveGuards.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it, vi } from "vitest";import { PdfiumSave } from "@app/tools/pdfTextEditor/pdfium/PdfiumSave";import type { EditorDocument } from "@app/tools/pdfTextEditor/model/EditorDocument";diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/rotation.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/rotation.test.tsindex 14d7b2ba8d..699d8f6e4b 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/rotation.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/rotation.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {rotationFromMatrix,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/savedBytes.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/savedBytes.test.tsindex f113c7232d..4a2e414f7e 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/savedBytes.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/savedBytes.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {assertIncrementalAppend,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/scanLayout.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/scanLayout.test.tsindex 1ccc0a585d..4c405d82e6 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/scanLayout.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/scanLayout.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {layoutScanEdit,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/scanSampling.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/scanSampling.test.tsindex 073a079ae1..520368d34d 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/scanSampling.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/scanSampling.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect, vi } from "vitest";import { DisplayTransform } from "@app/tools/pdfTextEditor/model/DisplayTransform";import { TableModel } from "@app/tools/pdfTextEditor/model/TableModel";diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/sha256.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/sha256.test.tsindex 18cd97de64..a4c5b255b7 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/sha256.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/sha256.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { createHash } from "node:crypto";diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/tableDetection.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/tableDetection.test.tsindex 16c6e1c7aa..254115f3f5 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/tableDetection.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/tableDetection.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {bandByRules,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/tableGeometry.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/tableGeometry.test.tsindex e6076945ce..1320ecb965 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/tableGeometry.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/tableGeometry.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {insertColumnEdges,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/tableStyle.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/tableStyle.test.tsindex f773a9629e..9a459253ca 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/tableStyle.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/tableStyle.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import type { TextRun } from "@app/tools/pdfTextEditor/model/TextRun";import {diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/textMatching.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/textMatching.test.tsindex fd811bdbac..0060c1f569 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/textMatching.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/textMatching.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {findMatches,diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/toolbarState.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/toolbarState.test.tsindex e30f585e1e..5dd665e8d7 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/toolbarState.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/toolbarState.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import { deriveToolbarState } from "@app/tools/pdfTextEditor/util/toolbarState";import type {diff --git a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/wordGrouping.test.ts b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/wordGrouping.test.tsindex f34c4be681..818ef6959c 100644--- a/frontend/editor/src/core/tools/pdfTextEditor/__tests__/wordGrouping.test.ts+++ b/frontend/editor/src/core/tools/pdfTextEditor/__tests__/wordGrouping.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {endsWithSpace,diff --git a/frontend/editor/src/core/types/folder.test.ts b/frontend/editor/src/core/types/folder.test.tsindex 2e2c726572..74ee9be795 100644--- a/frontend/editor/src/core/types/folder.test.ts+++ b/frontend/editor/src/core/types/folder.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test } from "vitest";import {diskFolderId,diff --git a/frontend/editor/src/core/utils/asciiBytes.test.ts b/frontend/editor/src/core/utils/asciiBytes.test.tsindex f26fd166e5..cf0bf4dd30 100644--- a/frontend/editor/src/core/utils/asciiBytes.test.ts+++ b/frontend/editor/src/core/utils/asciiBytes.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { hasAcroForm } from "@app/utils/asciiBytes";diff --git a/frontend/editor/src/core/utils/automationConverter.test.ts b/frontend/editor/src/core/utils/automationConverter.test.tsindex 9b6e21b7b0..da1d810cf5 100644--- a/frontend/editor/src/core/utils/automationConverter.test.ts+++ b/frontend/editor/src/core/utils/automationConverter.test.ts@@ -1,3 +1,4 @@+// @vitest-environment node/*** Unit tests for automationConverter import/export round-tripping.*/diff --git a/frontend/editor/src/core/utils/bulkselection/parseSelection.test.ts b/frontend/editor/src/core/utils/bulkselection/parseSelection.test.tsindex a7ebf48c97..8d4b98de0b 100644--- a/frontend/editor/src/core/utils/bulkselection/parseSelection.test.ts+++ b/frontend/editor/src/core/utils/bulkselection/parseSelection.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import { parseSelection } from "@app/utils/bulkselection/parseSelection";diff --git a/frontend/editor/src/core/utils/convertUtils.test.ts b/frontend/editor/src/core/utils/convertUtils.test.tsindex a538e62939..c2faa3c614 100644--- a/frontend/editor/src/core/utils/convertUtils.test.ts+++ b/frontend/editor/src/core/utils/convertUtils.test.ts@@ -1,3 +1,4 @@+// @vitest-environment node/*** Unit tests for convertUtils*/diff --git a/frontend/editor/src/core/utils/duplicateFile.test.ts b/frontend/editor/src/core/utils/duplicateFile.test.tsindex c8d1ccc6b8..efc2c8fea8 100644--- a/frontend/editor/src/core/utils/duplicateFile.test.ts+++ b/frontend/editor/src/core/utils/duplicateFile.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect, vi, beforeEach } from "vitest";import type { StirlingFile, StirlingFileStub } from "@app/types/fileContext";import type { FileId } from "@app/types/file";diff --git a/frontend/editor/src/core/utils/folderPath.test.ts b/frontend/editor/src/core/utils/folderPath.test.tsindex de092e6a67..65bcb452be 100644--- a/frontend/editor/src/core/utils/folderPath.test.ts+++ b/frontend/editor/src/core/utils/folderPath.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { createFolderId, type FolderRecord } from "@app/types/folder";import { getFolderChain, getFolderPath } from "@app/utils/folderPath";diff --git a/frontend/editor/src/core/utils/fuzzySearch.test.ts b/frontend/editor/src/core/utils/fuzzySearch.test.tsindex c88fae4038..9b6ed79875 100644--- a/frontend/editor/src/core/utils/fuzzySearch.test.ts+++ b/frontend/editor/src/core/utils/fuzzySearch.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {scoreMatch,diff --git a/frontend/editor/src/core/utils/homePageNavigation.test.ts b/frontend/editor/src/core/utils/homePageNavigation.test.tsindex 1d0a14364f..34942f3f0d 100644--- a/frontend/editor/src/core/utils/homePageNavigation.test.ts+++ b/frontend/editor/src/core/utils/homePageNavigation.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { getStartupNavigationAction } from "@app/utils/homePageNavigation";diff --git a/frontend/editor/src/core/utils/measurementUtils.test.ts b/frontend/editor/src/core/utils/measurementUtils.test.tsindex 33cf3f5c2d..aaee71db91 100644--- a/frontend/editor/src/core/utils/measurementUtils.test.ts+++ b/frontend/editor/src/core/utils/measurementUtils.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test } from "vitest";import {POINT_TO_UNIT,diff --git a/frontend/editor/src/core/utils/mobileScannerThumbs.test.ts b/frontend/editor/src/core/utils/mobileScannerThumbs.test.tsindex 68dc21e2d7..551bd37225 100644--- a/frontend/editor/src/core/utils/mobileScannerThumbs.test.ts+++ b/frontend/editor/src/core/utils/mobileScannerThumbs.test.ts@@ -1,3 +1,4 @@+// @vitest-environment node/*** Unit tests for fitThumbs, which sizes the mobile scanner's thumbnail strip.*diff --git a/frontend/editor/src/core/utils/mobileScannerUrl.test.ts b/frontend/editor/src/core/utils/mobileScannerUrl.test.tsindex 024eeaf54a..c5a805940d 100644--- a/frontend/editor/src/core/utils/mobileScannerUrl.test.ts+++ b/frontend/editor/src/core/utils/mobileScannerUrl.test.ts@@ -1,3 +1,4 @@+// @vitest-environment node/*** Unit tests for buildMobileScannerUrl.*diff --git a/frontend/editor/src/core/utils/patchReadableStreamAsyncIterator.test.ts b/frontend/editor/src/core/utils/patchReadableStreamAsyncIterator.test.tsindex d9db1fe62d..87b771d450 100644--- a/frontend/editor/src/core/utils/patchReadableStreamAsyncIterator.test.ts+++ b/frontend/editor/src/core/utils/patchReadableStreamAsyncIterator.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { afterEach, beforeEach, describe, expect, it } from "vitest";import { patchReadableStreamAsyncIterator } from "@app/utils/patchReadableStreamAsyncIterator";diff --git a/frontend/editor/src/core/utils/portfolioMembers.test.ts b/frontend/editor/src/core/utils/portfolioMembers.test.tsindex a3912203bd..74a3e73e2f 100644--- a/frontend/editor/src/core/utils/portfolioMembers.test.ts+++ b/frontend/editor/src/core/utils/portfolioMembers.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it, vi } from "vitest";import { PDFDocument, PDFName } from "@cantoo/pdf-lib";diff --git a/frontend/editor/src/core/utils/signatureImage.test.ts b/frontend/editor/src/core/utils/signatureImage.test.tsindex 340f847e0e..f446be5f43 100644--- a/frontend/editor/src/core/utils/signatureImage.test.ts+++ b/frontend/editor/src/core/utils/signatureImage.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {deriveInitials,diff --git a/frontend/editor/src/core/utils/uniqueName.test.ts b/frontend/editor/src/core/utils/uniqueName.test.tsindex 79fce34737..5210d1b4f1 100644--- a/frontend/editor/src/core/utils/uniqueName.test.ts+++ b/frontend/editor/src/core/utils/uniqueName.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { uniqueName } from "@app/utils/uniqueName";diff --git a/frontend/editor/src/desktop/components/onboarding/classificationDemo/backgroundClassification.test.ts b/frontend/editor/src/desktop/components/onboarding/classificationDemo/backgroundClassification.test.tsindex c34af1896d..5293ba2bce 100644--- a/frontend/editor/src/desktop/components/onboarding/classificationDemo/backgroundClassification.test.ts+++ b/frontend/editor/src/desktop/components/onboarding/classificationDemo/backgroundClassification.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, describe, expect, test } from "vitest";import {claimBackgroundClassification,diff --git a/frontend/editor/src/desktop/services/aiBaseUrl.test.ts b/frontend/editor/src/desktop/services/aiBaseUrl.test.tsindex 18b4e193d5..54f272a884 100644--- a/frontend/editor/src/desktop/services/aiBaseUrl.test.ts+++ b/frontend/editor/src/desktop/services/aiBaseUrl.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, describe, expect, test, vi } from "vitest";const mocks = vi.hoisted(() => ({diff --git a/frontend/editor/src/desktop/services/diskConflictPrompt.test.ts b/frontend/editor/src/desktop/services/diskConflictPrompt.test.tsindex d320ede598..69844f9c90 100644--- a/frontend/editor/src/desktop/services/diskConflictPrompt.test.ts+++ b/frontend/editor/src/desktop/services/diskConflictPrompt.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect, vi, beforeEach } from "vitest";import type { FileId } from "@app/types/file";import { expectConsole } from "@app/tests/failOnConsole";diff --git a/frontend/editor/src/desktop/services/launchFiles.test.ts b/frontend/editor/src/desktop/services/launchFiles.test.tsindex ed49a98792..c119ce75ac 100644--- a/frontend/editor/src/desktop/services/launchFiles.test.ts+++ b/frontend/editor/src/desktop/services/launchFiles.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, describe, expect, it, vi } from "vitest";const queue = vi.hoisted(() => ({ files: [] as string[] }));diff --git a/frontend/editor/src/desktop/services/localFileSaveService.test.ts b/frontend/editor/src/desktop/services/localFileSaveService.test.tsindex bc080c282f..4cae41c29e 100644--- a/frontend/editor/src/desktop/services/localFileSaveService.test.ts+++ b/frontend/editor/src/desktop/services/localFileSaveService.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test, vi, beforeEach } from "vitest";import { expectConsole } from "@app/tests/failOnConsole";import type { StirlingFileStub } from "@app/types/fileContext";diff --git a/frontend/editor/src/desktop/services/localProcessingOriginals.test.ts b/frontend/editor/src/desktop/services/localProcessingOriginals.test.tsindex a53e5e63cd..781db75af7 100644--- a/frontend/editor/src/desktop/services/localProcessingOriginals.test.ts+++ b/frontend/editor/src/desktop/services/localProcessingOriginals.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, expect, test, vi } from "vitest";import type {LocalProcessingFile,diff --git a/frontend/editor/src/desktop/services/operationRouter.test.ts b/frontend/editor/src/desktop/services/operationRouter.test.tsindex 042574c21e..09d7f6dc1d 100644--- a/frontend/editor/src/desktop/services/operationRouter.test.ts+++ b/frontend/editor/src/desktop/services/operationRouter.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, describe, expect, test, vi } from "vitest";// Verifies operationRouter.getBaseUrl host selection in SaaS mode: cloud-onlydiff --git a/frontend/editor/src/desktop/services/policyOutputBaseUrl.test.ts b/frontend/editor/src/desktop/services/policyOutputBaseUrl.test.tsindex bbd2c40e63..aab5c48f45 100644--- a/frontend/editor/src/desktop/services/policyOutputBaseUrl.test.ts+++ b/frontend/editor/src/desktop/services/policyOutputBaseUrl.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, describe, expect, test, vi } from "vitest";const mocks = vi.hoisted(() => ({diff --git a/frontend/editor/src/desktop/services/saasAppConfigService.test.ts b/frontend/editor/src/desktop/services/saasAppConfigService.test.tsindex 2eaf8edf8f..67e8201a16 100644--- a/frontend/editor/src/desktop/services/saasAppConfigService.test.ts+++ b/frontend/editor/src/desktop/services/saasAppConfigService.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test, vi, beforeEach } from "vitest";import { expectConsole } from "@app/tests/failOnConsole";diff --git a/frontend/editor/src/desktop/services/serverPipeline.test.ts b/frontend/editor/src/desktop/services/serverPipeline.test.tsindex 87431cc05d..06d7f2a940 100644--- a/frontend/editor/src/desktop/services/serverPipeline.test.ts+++ b/frontend/editor/src/desktop/services/serverPipeline.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, expect, test, vi } from "vitest";const mocks = vi.hoisted(() => ({ post: vi.fn(), get: vi.fn() }));vi.mock("@app/services/apiClient", () => ({ default: mocks }));diff --git a/frontend/editor/src/desktop/services/tauriHttpClient.test.ts b/frontend/editor/src/desktop/services/tauriHttpClient.test.tsindex 186fdf16af..ca309a687b 100644--- a/frontend/editor/src/desktop/services/tauriHttpClient.test.ts+++ b/frontend/editor/src/desktop/services/tauriHttpClient.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test, vi, beforeEach, afterEach } from "vitest";// Regression: a caller-set "Content-Type: multipart/form-data" (no boundary) on adiff --git a/frontend/editor/src/portal-saas/api/localBackend.test.ts b/frontend/editor/src/portal-saas/api/localBackend.test.tsindex 0c7fa21058..8c784a0fe7 100644--- a/frontend/editor/src/portal-saas/api/localBackend.test.ts+++ b/frontend/editor/src/portal-saas/api/localBackend.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { afterEach, describe, expect, it, vi } from "vitest";const getPortalSaasToken = vi.fn();diff --git a/frontend/editor/src/portal-saas/api/saasApiBase.test.ts b/frontend/editor/src/portal-saas/api/saasApiBase.test.tsindex 6330ea4755..173f8c14d7 100644--- a/frontend/editor/src/portal-saas/api/saasApiBase.test.ts+++ b/frontend/editor/src/portal-saas/api/saasApiBase.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { afterEach, describe, expect, it, vi } from "vitest";import { saasApiBase } from "@portal/api/saasApiBase";diff --git a/frontend/editor/src/portal-saas/components/pipelines/outputModes.test.ts b/frontend/editor/src/portal-saas/components/pipelines/outputModes.test.tsindex f603744d73..341974516c 100644--- a/frontend/editor/src/portal-saas/components/pipelines/outputModes.test.ts+++ b/frontend/editor/src/portal-saas/components/pipelines/outputModes.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";// Resolves to the SaaS override (src/portal-saas) via the @portal cascade.import { availableOutputModes } from "@portal/components/pipelines/outputModes";diff --git a/frontend/editor/src/portal-saas/components/settings/accountLinkSettings.test.ts b/frontend/editor/src/portal-saas/components/settings/accountLinkSettings.test.tsindex 60d3de1427..2f95187f8a 100644--- a/frontend/editor/src/portal-saas/components/settings/accountLinkSettings.test.ts+++ b/frontend/editor/src/portal-saas/components/settings/accountLinkSettings.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { accountLinkSettings } from "@portal/components/settings/accountLinkSettings";diff --git a/frontend/editor/src/portal-saas/components/sources/creatableSourceTypes.test.ts b/frontend/editor/src/portal-saas/components/sources/creatableSourceTypes.test.tsindex 1eec2ac959..2e579f9ed3 100644--- a/frontend/editor/src/portal-saas/components/sources/creatableSourceTypes.test.ts+++ b/frontend/editor/src/portal-saas/components/sources/creatableSourceTypes.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";// Resolves to the SaaS override (src/portal-saas) via the @portal cascade.import { creatableSourceTypes } from "@portal/components/sources/creatableSourceTypes";diff --git a/frontend/editor/src/portal/api/fileRunEvents.test.ts b/frontend/editor/src/portal/api/fileRunEvents.test.tsindex 0e1729a891..29d186098c 100644--- a/frontend/editor/src/portal/api/fileRunEvents.test.ts+++ b/frontend/editor/src/portal/api/fileRunEvents.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, describe, expect, it, vi } from "vitest";/**diff --git a/frontend/editor/src/portal/auth/saasSupabase.test.ts b/frontend/editor/src/portal/auth/saasSupabase.test.tsindex 9ccefcaacd..349f224e6b 100644--- a/frontend/editor/src/portal/auth/saasSupabase.test.ts+++ b/frontend/editor/src/portal/auth/saasSupabase.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { afterEach, describe, expect, it, vi } from "vitest";// Mock only the low-level client factory — NOT ensureSaasSupabase itself — so thisdiff --git a/frontend/editor/src/portal/billing/sharedBillingFormat.test.ts b/frontend/editor/src/portal/billing/sharedBillingFormat.test.tsindex fd0bf41513..3d2bc91c9e 100644--- a/frontend/editor/src/portal/billing/sharedBillingFormat.test.ts+++ b/frontend/editor/src/portal/billing/sharedBillingFormat.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {currencySymbol,diff --git a/frontend/editor/src/portal/components/pipelines/PipelineStepSettings.test.tsx b/frontend/editor/src/portal/components/pipelines/PipelineStepSettings.test.tsxindex 0850499a99..d5ae3d611e 100644--- a/frontend/editor/src/portal/components/pipelines/PipelineStepSettings.test.tsx+++ b/frontend/editor/src/portal/components/pipelines/PipelineStepSettings.test.tsx@@ -269,52 +269,54 @@ describe("PipelineStepSettings: every tool's settings render in the portal", ()// Guard against the filter silently matching nothing (e.g. a registry-shape change).expect(editableTools.length).toBeGreaterThan(10);+ // Rendered together so their lazy imports load concurrently; each keeps its own boundary, so a+ // crash is still attributed to the tool that threw.const failures: { toolId: string; message: string }[] = [];+ render(+ <PortalTestProviders>+ <PreferencesProvider>+ <SidebarProvider>+ {editableTools.map(([toolId, entry]) => {+ const Settings = entry.automationSettings as ComponentType<+ ToolAutomationSettingsProps<ErasedToolParams>+ >;+ const params = entry.operationConfig?.defaultParameters ?? {};+ return (+ <CaptureBoundary+ key={toolId}+ onError={(error) => {+ failures.push({ toolId, message: error.message });+ }}+ >+ <Suspense fallback={null}>+ <Settings+ parameters={params}+ onParameterChange={() => {}}+ disabled={false}+ />+ <span data-testid={`rendered-${toolId}`} />+ </Suspense>+ </CaptureBoundary>+ );+ })}+ </SidebarProvider>+ </PreferencesProvider>+ </PortalTestProviders>,+ );- for (const [toolId, entry] of editableTools) {- const Settings = entry.automationSettings as ComponentType<- ToolAutomationSettingsProps<ErasedToolParams>- >;- const params = entry.operationConfig?.defaultParameters ?? {};-- const caught: { error: Error | null } = { error: null };- // The sentinel sibling commits only once the lazy Settings actually renders, so we wait for a- // real render (or a caught throw) - not just the providers' wrapper DOM.- const { unmount } = render(- <PortalTestProviders>- <PreferencesProvider>- <SidebarProvider>- <CaptureBoundary- onError={(error) => {- caught.error = error;- }}- >- <Suspense fallback={null}>- <Settings- parameters={params}- onParameterChange={() => {}}- disabled={false}- />- <span data-testid={`rendered-${toolId}`} />- </Suspense>- </CaptureBoundary>- </SidebarProvider>- </PreferencesProvider>- </PortalTestProviders>,- );-- await waitFor(() =>- expect(- caught.error !== null ||- screen.queryByTestId(`rendered-${toolId}`) !== null,- ).toBe(true),- );-- if (caught.error) {- failures.push({ toolId, message: caught.error.message });- }- unmount();- }+ // The sentinel sibling commits only once the lazy Settings actually renders, so this waits for+ // a real render (or a caught throw) of every tool - not just the providers' wrapper DOM.+ await waitFor(+ () => {+ for (const [toolId] of editableTools) {+ expect(+ failures.some((failure) => failure.toolId === toolId) ||+ screen.queryByTestId(`rendered-${toolId}`) !== null,+ ).toBe(true);+ }+ },+ { timeout: 20000 },+ );expect(failures).toEqual([]);}, 30000);diff --git a/frontend/editor/src/portal/components/pipelines/docparseStep.test.ts b/frontend/editor/src/portal/components/pipelines/docparseStep.test.tsindex fd17028407..7ba9828a0c 100644--- a/frontend/editor/src/portal/components/pipelines/docparseStep.test.ts+++ b/frontend/editor/src/portal/components/pipelines/docparseStep.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {newIngestStep,diff --git a/frontend/editor/src/portal/components/pipelines/graph/pipelineLayout.test.ts b/frontend/editor/src/portal/components/pipelines/graph/pipelineLayout.test.tsindex d03e6b3c42..1745109732 100644--- a/frontend/editor/src/portal/components/pipelines/graph/pipelineLayout.test.ts+++ b/frontend/editor/src/portal/components/pipelines/graph/pipelineLayout.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test } from "vitest";import {EDGE_LENGTH,diff --git a/frontend/editor/src/portal/components/pipelines/integrationStep.test.ts b/frontend/editor/src/portal/components/pipelines/integrationStep.test.tsindex e8ea993088..14b32fde97 100644--- a/frontend/editor/src/portal/components/pipelines/integrationStep.test.ts+++ b/frontend/editor/src/portal/components/pipelines/integrationStep.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {diff --git a/frontend/editor/src/portal/components/pipelines/pipelineIcon.test.ts b/frontend/editor/src/portal/components/pipelines/pipelineIcon.test.tsindex c29fa8c372..7e7c4793dd 100644--- a/frontend/editor/src/portal/components/pipelines/pipelineIcon.test.ts+++ b/frontend/editor/src/portal/components/pipelines/pipelineIcon.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { canonicalPipelineIconKey } from "@portal/components/pipelines/pipelineIcon";diff --git a/frontend/editor/src/portal/components/sources/connectionTypes.test.ts b/frontend/editor/src/portal/components/sources/connectionTypes.test.tsindex bf59c201bf..3ef1b03b98 100644--- a/frontend/editor/src/portal/components/sources/connectionTypes.test.ts+++ b/frontend/editor/src/portal/components/sources/connectionTypes.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {diff --git a/frontend/editor/src/portal/mocks/link.test.ts b/frontend/editor/src/portal/mocks/link.test.tsindex bd1cd505ef..f837a3c8a6 100644--- a/frontend/editor/src/portal/mocks/link.test.ts+++ b/frontend/editor/src/portal/mocks/link.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, describe, expect, it } from "vitest";import {getLocalStatus,diff --git a/frontend/editor/src/portal/setupTests.ts b/frontend/editor/src/portal/setupTests.tsindex 94164c3e03..f3f2b9f7f5 100644--- a/frontend/editor/src/portal/setupTests.ts+++ b/frontend/editor/src/portal/setupTests.ts@@ -44,7 +44,7 @@ class LocalStorageMock implements Storage {}}-Object.defineProperty(window, "localStorage", {+Object.defineProperty(globalThis, "localStorage", {value: new LocalStorageMock(),writable: true,});@@ -61,7 +61,7 @@ global.IntersectionObserver = vi.fn().mockImplementation(() => ({disconnect: vi.fn(),}));-Object.defineProperty(window, "matchMedia", {+Object.defineProperty(globalThis, "matchMedia", {writable: true,value: vi.fn().mockImplementation((query: string) => ({matches: false,diff --git a/frontend/editor/src/proprietary/billing/format.test.ts b/frontend/editor/src/proprietary/billing/format.test.tsindex e7a5c1b029..cfed91438e 100644--- a/frontend/editor/src/proprietary/billing/format.test.ts+++ b/frontend/editor/src/proprietary/billing/format.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {estimateMonthlyVolumeFromUsers,diff --git a/frontend/editor/src/proprietary/billing/pendingUsage.test.ts b/frontend/editor/src/proprietary/billing/pendingUsage.test.tsindex bba05eadb5..e58f486a34 100644--- a/frontend/editor/src/proprietary/billing/pendingUsage.test.ts+++ b/frontend/editor/src/proprietary/billing/pendingUsage.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { estimatedBillWithPending } from "@app/billing/pendingUsage";import { subscribedWallet } from "@app/billing/walletFixtures";diff --git a/frontend/editor/src/proprietary/components/policies/dispatchSemaphore.test.ts b/frontend/editor/src/proprietary/components/policies/dispatchSemaphore.test.tsindex 355d8b5526..499e10ed32 100644--- a/frontend/editor/src/proprietary/components/policies/dispatchSemaphore.test.ts+++ b/frontend/editor/src/proprietary/components/policies/dispatchSemaphore.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect, beforeEach } from "vitest";import {acquireDispatchSlot,diff --git a/frontend/editor/src/proprietary/components/settings/portalSettingsNav.test.ts b/frontend/editor/src/proprietary/components/settings/portalSettingsNav.test.tsindex ae764e22fe..8c2172079c 100644--- a/frontend/editor/src/proprietary/components/settings/portalSettingsNav.test.ts+++ b/frontend/editor/src/proprietary/components/settings/portalSettingsNav.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import type {ConfigNavSection,diff --git a/frontend/editor/src/proprietary/components/shared/config/configSections/advanced/advancedSettings.test.ts b/frontend/editor/src/proprietary/components/shared/config/configSections/advanced/advancedSettings.test.tsindex f225c6be4f..d4173fac02 100644--- a/frontend/editor/src/proprietary/components/shared/config/configSections/advanced/advancedSettings.test.ts+++ b/frontend/editor/src/proprietary/components/shared/config/configSections/advanced/advancedSettings.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, test } from "vitest";import {DEFAULT_DATASOURCE,diff --git a/frontend/editor/src/proprietary/components/shared/config/configSections/aiEngineSettings.test.ts b/frontend/editor/src/proprietary/components/shared/config/configSections/aiEngineSettings.test.tsindex 5bd0da6b4f..2f45eba9ef 100644--- a/frontend/editor/src/proprietary/components/shared/config/configSections/aiEngineSettings.test.ts+++ b/frontend/editor/src/proprietary/components/shared/config/configSections/aiEngineSettings.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import {clampMin,diff --git a/frontend/editor/src/proprietary/components/shared/config/configSections/security/securitySettingsTransformers.test.ts b/frontend/editor/src/proprietary/components/shared/config/configSections/security/securitySettingsTransformers.test.tsindex fd558264c0..b58aadbf74 100644--- a/frontend/editor/src/proprietary/components/shared/config/configSections/security/securitySettingsTransformers.test.ts+++ b/frontend/editor/src/proprietary/components/shared/config/configSections/security/securitySettingsTransformers.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, describe, expect, it, vi } from "vitest";import apiClient from "@app/services/apiClient";import {diff --git a/frontend/editor/src/proprietary/components/shared/fileSidebarGrouping.test.ts b/frontend/editor/src/proprietary/components/shared/fileSidebarGrouping.test.tsindex 07f9d5c7db..2bc2bbd5e3 100644--- a/frontend/editor/src/proprietary/components/shared/fileSidebarGrouping.test.ts+++ b/frontend/editor/src/proprietary/components/shared/fileSidebarGrouping.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import { buildLabelGroups } from "@app/components/shared/fileSidebarGroupingLogic";import type { SidebarCategory } from "@app/services/fileSidebarCategories";diff --git a/frontend/editor/src/proprietary/data/classificationPolicy.test.ts b/frontend/editor/src/proprietary/data/classificationPolicy.test.tsindex 0b4dcb9d51..2e4e102c43 100644--- a/frontend/editor/src/proprietary/data/classificationPolicy.test.ts+++ b/frontend/editor/src/proprietary/data/classificationPolicy.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {isClassificationPolicy,diff --git a/frontend/editor/src/proprietary/policies/codec.test.ts b/frontend/editor/src/proprietary/policies/codec.test.tsindex 7b5f298578..86072f3cb4 100644--- a/frontend/editor/src/proprietary/policies/codec.test.ts+++ b/frontend/editor/src/proprietary/policies/codec.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { classificationCondition } from "@app/data/classificationConditions";import { readFileSync } from "node:fs";import { resolve } from "node:path";diff --git a/frontend/editor/src/proprietary/policies/runs.test.ts b/frontend/editor/src/proprietary/policies/runs.test.tsindex 402e2f693c..7cc1126c88 100644--- a/frontend/editor/src/proprietary/policies/runs.test.ts+++ b/frontend/editor/src/proprietary/policies/runs.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import { runsToStats, runsToActivity } from "@app/policies/runs";import type { PolicyRunView } from "@app/policies/types";diff --git a/frontend/editor/src/proprietary/services/creditPromptPipelines.test.ts b/frontend/editor/src/proprietary/services/creditPromptPipelines.test.tsindex d88d0ac7df..3badd50ceb 100644--- a/frontend/editor/src/proprietary/services/creditPromptPipelines.test.ts+++ b/frontend/editor/src/proprietary/services/creditPromptPipelines.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, describe, expect, it, vi } from "vitest";import {fetchCreditPromptPipelines,diff --git a/frontend/editor/src/proprietary/services/licenseService.currency.test.ts b/frontend/editor/src/proprietary/services/licenseService.currency.test.tsindex f80b266b39..45eec0dfb8 100644--- a/frontend/editor/src/proprietary/services/licenseService.currency.test.ts+++ b/frontend/editor/src/proprietary/services/licenseService.currency.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { expect, it, vi } from "vitest";const { invoke } = vi.hoisted(() => ({ invoke: vi.fn() }));vi.mock("@app/services/supabaseClient", () => ({diff --git a/frontend/editor/src/proprietary/services/policyBackend.test.ts b/frontend/editor/src/proprietary/services/policyBackend.test.tsindex 6d86fc159f..2ab22735d0 100644--- a/frontend/editor/src/proprietary/services/policyBackend.test.ts+++ b/frontend/editor/src/proprietary/services/policyBackend.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect, vi, beforeEach } from "vitest";import {decodedToState,diff --git a/frontend/editor/src/proprietary/services/policyCreditContext.test.ts b/frontend/editor/src/proprietary/services/policyCreditContext.test.tsindex 39d56666a7..a3bcf5a070 100644--- a/frontend/editor/src/proprietary/services/policyCreditContext.test.ts+++ b/frontend/editor/src/proprietary/services/policyCreditContext.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it, vi } from "vitest";import { policyCreditContext } from "@app/services/policyCreditContext";diff --git a/frontend/editor/src/proprietary/services/policyInput.test.ts b/frontend/editor/src/proprietary/services/policyInput.test.tsindex 55b5c2b1ab..bee105d1eb 100644--- a/frontend/editor/src/proprietary/services/policyInput.test.ts+++ b/frontend/editor/src/proprietary/services/policyInput.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { policyAcceptsFile } from "@app/services/policyInput";import type { PolicyState } from "@app/types/policies";diff --git a/frontend/editor/src/proprietary/services/policyPipeline.test.ts b/frontend/editor/src/proprietary/services/policyPipeline.test.tsindex f79310a3a2..5f8e1a5db3 100644--- a/frontend/editor/src/proprietary/services/policyPipeline.test.ts+++ b/frontend/editor/src/proprietary/services/policyPipeline.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import {fromBackendPolicy,diff --git a/frontend/editor/src/proprietary/services/postLoginRedirect.test.ts b/frontend/editor/src/proprietary/services/postLoginRedirect.test.tsindex 6f2451f336..90a09da7e8 100644--- a/frontend/editor/src/proprietary/services/postLoginRedirect.test.ts+++ b/frontend/editor/src/proprietary/services/postLoginRedirect.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, expect, it } from "vitest";import { isSafePostLoginRedirect } from "@app/services/postLoginRedirect";diff --git a/frontend/editor/src/proprietary/services/processingRunDelivery.test.ts b/frontend/editor/src/proprietary/services/processingRunDelivery.test.tsindex b1080f7147..195bfc22b8 100644--- a/frontend/editor/src/proprietary/services/processingRunDelivery.test.ts+++ b/frontend/editor/src/proprietary/services/processingRunDelivery.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect, vi, beforeEach } from "vitest";const fetchRuns = vi.fn();diff --git a/frontend/editor/src/proprietary/services/serverPlanCheckout.test.ts b/frontend/editor/src/proprietary/services/serverPlanCheckout.test.tsindex d9384dd14f..b4aa30a82b 100644--- a/frontend/editor/src/proprietary/services/serverPlanCheckout.test.ts+++ b/frontend/editor/src/proprietary/services/serverPlanCheckout.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, describe, expect, it, vi } from "vitest";/**diff --git a/frontend/editor/src/proprietary/utils/licenseCheckoutUtils.test.ts b/frontend/editor/src/proprietary/utils/licenseCheckoutUtils.test.tsindex 87f9b25202..bb0a9f7883 100644--- a/frontend/editor/src/proprietary/utils/licenseCheckoutUtils.test.ts+++ b/frontend/editor/src/proprietary/utils/licenseCheckoutUtils.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { expect, it, vi } from "vitest";import { pollTeamCheckout } from "@app/utils/licenseCheckoutUtils";import { verifyTeamCheckout } from "@app/services/serverPlanCheckout";diff --git a/frontend/editor/src/proprietary/utils/teamCheckout.test.ts b/frontend/editor/src/proprietary/utils/teamCheckout.test.tsindex 3b4132be74..adf915585c 100644--- a/frontend/editor/src/proprietary/utils/teamCheckout.test.ts+++ b/frontend/editor/src/proprietary/utils/teamCheckout.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { beforeEach, expect, it, vi } from "vitest";const { verify, resync, info, requiresLocal } = vi.hoisted(() => ({verify: vi.fn(),diff --git a/frontend/editor/src/saas/auth/UseSession.test.ts b/frontend/editor/src/saas/auth/UseSession.test.tsindex 94e1ffcb6a..056574274f 100644--- a/frontend/editor/src/saas/auth/UseSession.test.ts+++ b/frontend/editor/src/saas/auth/UseSession.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";import type { TFunction } from "i18next";import { deriveDisplayName, type User } from "@app/auth/UseSession";diff --git a/frontend/editor/src/saas/components/onboarding/saasFlowResolver.test.ts b/frontend/editor/src/saas/components/onboarding/saasFlowResolver.test.tsindex 3af525ca17..5c0a503693 100644--- a/frontend/editor/src/saas/components/onboarding/saasFlowResolver.test.ts+++ b/frontend/editor/src/saas/components/onboarding/saasFlowResolver.test.ts@@ -1,3 +1,4 @@+// @vitest-environment nodeimport { describe, it, expect } from "vitest";// Resolves through the saas cascade to the cloud impldiff --git a/frontend/editor/src/saas/routes/AuthCallback.destination.test.tsx b/frontend/editor/src/saas/routes/AuthCallback.destination.test.tsxindex 23d525ea11..941dfeb75d 100644--- a/frontend/editor/src/saas/routes/AuthCallback.destination.test.tsx+++ b/frontend/editor/src/saas/routes/AuthCallback.destination.test.tsx@@ -1,5 +1,5 @@-import { beforeEach, describe, expect, it, vi } from "vitest";-import { render, waitFor } from "@testing-library/react";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { act, render } from "@testing-library/react";import AuthCallback from "@app/routes/AuthCallback";import { supabase } from "@app/auth/supabase";import {@@ -29,11 +29,11 @@ vi.mock("@app/utils/loginLanding", () => ({async function arriveAtCallback(search = "") {window.history.replaceState({}, "", `/auth/callback${search}`);render(<AuthCallback />);- // Real timers: the redirect timeout is only scheduled once the awaited session- // resolves, which a fake-timer sweep races rather than observes.- await waitFor(() => expect(mockNavigate).toHaveBeenCalled(), {- timeout: 3000,- });+ // The redirect timeout is only scheduled once the awaited session resolves;+ // the async sweep yields to pending promises before each timer, so it still+ // fires, without waiting out the real delay.+ await act(() => vi.runAllTimersAsync());+ expect(mockNavigate).toHaveBeenCalled();}function landedOn() {@@ -42,6 +42,7 @@ function landedOn() {}beforeEach(() => {+ vi.useFakeTimers();localStorage.clear();resetPendingDestinationForTests();mockNavigate.mockClear();@@ -51,6 +52,10 @@ beforeEach(() => {} as unknown as Awaited<ReturnType<typeof supabase.auth.getSession>>);});+afterEach(() => {+ vi.useRealTimers();+});+describe("AuthCallback destination", () => {it("prefers an explicit next over anything remembered", async () => {rememberPendingDestination("/procurement");diff --git a/frontend/editor/src/saas/setupTests.ts b/frontend/editor/src/saas/setupTests.tsindex 1969e24d14..892e334b55 100644--- a/frontend/editor/src/saas/setupTests.ts+++ b/frontend/editor/src/saas/setupTests.ts@@ -169,7 +169,7 @@ global.IntersectionObserver = vi.fn().mockImplementation(() => ({}));// Mock matchMedia for responsive components-Object.defineProperty(window, "matchMedia", {+Object.defineProperty(globalThis, "matchMedia", {writable: true,value: vi.fn().mockImplementation((query) => ({matches: false,diff --git a/frontend/editor/vitest.config.ts b/frontend/editor/vitest.config.tsindex daad1b3fb1..33ad6e7690 100644--- a/frontend/editor/vitest.config.ts+++ b/frontend/editor/vitest.config.ts@@ -1,12 +1,39 @@+import { readFileSync } from "node:fs";import { defineConfig } from "vitest/config";import react from "@vitejs/plugin-react-swc";import tsconfigPaths from "vite-tsconfig-paths";// oxlint-disable-next-line no-restricted-imports -- config runs in node, before the aliases existimport { iconSvgr } from "./scripts/icons/svgrOptions.mts";-// Projects do NOT inherit the root test.testTimeout, so every project silently-// ran at vitest's 5s default. Spread this into each one instead.-const TIMEOUTS = { testTimeout: 10000, hookTimeout: 10000 };+const frontendPackage: { dependencies: Record<string, string> } = JSON.parse(+ readFileSync(new URL("../package.json", import.meta.url), "utf8"),+);++// Every @mantine/* package, so they share one pre-bundled core: one left+// unbundled imports its own copy and cannot see the bundled MantineProvider.+const MANTINE_PACKAGES = Object.keys(frontendPackage.dependencies).filter(+ (name) => name.startsWith("@mantine/"),+);++// Projects do NOT inherit the root test options, so every project silently ran+// at vitest's 5s default and printed all app stdout. Spread these into each one.+const TEST_DEFAULTS = {+ testTimeout: 10000,+ hookTimeout: 10000,+ // Threads spawn faster for local speed; CI keeps forks so a cross-file global+ // leak can't bleed between files in a shared process.+ pool: process.env.CI ? "forks" : "threads",+ // Mantine is hundreds of small ESM files that every component test re-imports;+ // pre-bundled it is one module (~250ms -> ~25ms of collect per file).+ deps: {+ optimizer: { web: { enabled: true, include: MANTINE_PACKAGES } },+ },+ // All our tests are designed to run in the browser+ testTransformMode: { web: ["**/*"] },+ onConsoleLog(_log: string, type: "stdout" | "stderr") {+ if (type === "stdout" && !process.env.VITEST_CONSOLE) return false;+ },+};export default defineConfig({test: {@@ -19,7 +46,7 @@ export default defineConfig({"src/**/*.spec.ts", // Exclude Playwright E2E tests"src/tests/test-fixtures/**",],- ...TIMEOUTS,+ ...TEST_DEFAULTS,coverage: {reporter: ["text", "json", "html"],exclude: [@@ -36,7 +63,7 @@ export default defineConfig({{test: {name: "core",- ...TIMEOUTS,+ ...TEST_DEFAULTS,include: ["src/core/**/*.test.{ts,tsx}"],environment: "jsdom",globals: true,@@ -56,7 +83,7 @@ export default defineConfig({{test: {name: "portal",- ...TIMEOUTS,+ ...TEST_DEFAULTS,include: ["src/portal/**/*.test.{ts,tsx}"],environment: "jsdom",globals: true,@@ -78,7 +105,7 @@ export default defineConfig({{test: {name: "proprietary",- ...TIMEOUTS,+ ...TEST_DEFAULTS,include: ["src/proprietary/**/*.test.{ts,tsx}"],environment: "jsdom",globals: true,@@ -98,7 +125,7 @@ export default defineConfig({{test: {name: "desktop",- ...TIMEOUTS,+ ...TEST_DEFAULTS,include: ["src/desktop/**/*.test.{ts,tsx}"],environment: "jsdom",globals: true,@@ -118,7 +145,7 @@ export default defineConfig({{test: {name: "saas",- ...TIMEOUTS,+ ...TEST_DEFAULTS,// src/saas = editor-saas layer; src/portal-saas = the portal's saas// overrides (sibling to src/portal). Both build under the saas flavor,// so both resolve @portal via the saas cascade (tsconfig.saas.vite.json).diff --git a/frontend/stylelint.config.mjs b/frontend/stylelint.config.mjsindex 79f3108c9c..927c5cdf5c 100644--- a/frontend/stylelint.config.mjs+++ b/frontend/stylelint.config.mjs@@ -3,6 +3,7 @@export default {ignoreFiles: ["**/dist/**",+ "**/coverage/**","**/src-tauri/**",// Vendored third-party CSS (its first-party customisation file IS linted)."**/editor/public/css/cookieconsent.css",