test: speed up browser and gateway suites

This commit is contained in:
Peter Steinberger 2026-03-24 17:26:52 +00:00
parent 435e2c5967
commit a8bf75f03e
2 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,6 @@
import fs from "node:fs";
import path from "node:path";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { BrowserRouteContext, BrowserServerState } from "./server-context.js";
vi.mock("../config/config.js", async (importOriginal) => {
@ -58,10 +58,13 @@ async function createWorkProfileWithConfig(params: {
}
describe("BrowserProfilesService", () => {
beforeEach(async () => {
beforeAll(async () => {
vi.resetModules();
({ resolveBrowserConfig } = await import("./config.js"));
({ createBrowserProfilesService } = await import("./profiles-service.js"));
});
beforeEach(() => {
vi.clearAllMocks();
});

View File

@ -1,5 +1,5 @@
import { Buffer } from "node:buffer";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { DeviceIdentity } from "../infra/device-identity.js";
import { captureEnv } from "../test-utils/env.js";
@ -160,7 +160,7 @@ function expectSecurityConnectError(
}
}
beforeEach(async () => {
beforeAll(async () => {
await loadGatewayClientModule();
});