test(ci): trim thread lane harness churn

This commit is contained in:
Vincent Koc
2026-03-19 11:26:04 -07:00
parent 14e84cf0b3
commit 962a8fea90
2 changed files with 10 additions and 6 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 { OpenClawConfig } from "../../config/config.js";
import { setActivePluginRegistry } from "../../plugins/runtime.js";
import { createOutboundTestPlugin, createTestRegistry } from "../../test-utils/channel-plugins.js";
@@ -77,9 +77,11 @@ function expectSuccessfulWhatsAppInternalHookPayload(
}
describe("deliverOutboundPayloads lifecycle", () => {
beforeEach(async () => {
vi.resetModules();
beforeAll(async () => {
({ deliverOutboundPayloads } = await import("./deliver.js"));
});
beforeEach(() => {
resetDeliverTestState();
resetDeliverTestMocks({ includeSessionMocks: true });
});

View File

@@ -1,5 +1,5 @@
import { completeSimple, type AssistantMessage } from "@mariozechner/pi-ai";
import { describe, expect, it, vi, beforeEach } from "vitest";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { ensureCustomApiRegistered } from "../agents/custom-api-registry.js";
import { getApiKeyForModel } from "../agents/model-auth.js";
import { resolveModelAsync } from "../agents/pi-embedded-runner/model.js";
@@ -374,8 +374,7 @@ describe("tts", () => {
messages: { tts: {} },
};
beforeEach(async () => {
vi.resetModules();
beforeAll(async () => {
({ completeSimple: completeSimpleForTest } = await import("@mariozechner/pi-ai"));
({ getApiKeyForModel: getApiKeyForModelForTest } = await import("../agents/model-auth.js"));
({ resolveModelAsync: resolveModelAsyncForTest } =
@@ -385,6 +384,9 @@ describe("tts", () => {
const ttsModule = await import("./tts.js");
summarizeTextForTest = ttsModule._test.summarizeText;
resolveTtsConfigForTest = ttsModule.resolveTtsConfig;
});
beforeEach(() => {
vi.mocked(completeSimpleForTest).mockResolvedValue(
mockAssistantMessage([{ type: "text", text: "Summary" }]),
);