test: speed up core runtime suites

This commit is contained in:
Peter Steinberger
2026-03-31 02:12:14 +01:00
parent f7285e0a9e
commit 6b6ddcd2a6
93 changed files with 874 additions and 980 deletions

View File

@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { SecretInput } from "../config/types.secrets.js";
vi.mock("../infra/device-bootstrap.js", () => ({
@@ -158,16 +158,18 @@ describe("pairing setup code", () => {
}
beforeEach(() => {
vi.resetModules();
vi.stubEnv("OPENCLAW_GATEWAY_TOKEN", "");
vi.stubEnv("OPENCLAW_GATEWAY_PASSWORD", "");
vi.stubEnv("OPENCLAW_GATEWAY_PORT", "");
});
beforeEach(async () => {
beforeAll(async () => {
({ encodePairingSetupCode, resolvePairingSetupFromConfig } = await import("./setup-code.js"));
({ issueDeviceBootstrapToken: issueDeviceBootstrapTokenMock } =
await import("../infra/device-bootstrap.js"));
});
beforeEach(() => {
vi.mocked(issueDeviceBootstrapTokenMock).mockClear();
});