test(ci): trim runtime test harness churn

This commit is contained in:
Vincent Koc
2026-03-19 11:16:24 -07:00
parent 9117836981
commit 14e84cf0b3
3 changed files with 18 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
import { Type } from "@sinclair/typebox";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import type { ChannelMessageCapability } from "../../channels/plugins/message-capabilities.js";
import type { ChannelMessageActionName, ChannelPlugin } from "../../channels/plugins/types.js";
import type { MessageActionRunResult } from "../../infra/outbound/message-action-runner.js";
@@ -86,17 +86,19 @@ function getActionEnum(properties: Record<string, unknown>) {
return (properties.action as { enum?: string[] } | undefined)?.enum ?? [];
}
beforeEach(async () => {
vi.resetModules();
beforeAll(async () => {
({ setActivePluginRegistry } = await import("../../plugins/runtime.js"));
({ createTestRegistry } = await import("../../test-utils/channel-plugins.js"));
({ createMessageTool } = await import("./message-tool.js"));
});
beforeEach(() => {
mocks.runMessageAction.mockReset();
mocks.loadConfig.mockReset().mockReturnValue({});
mocks.resolveCommandSecretRefsViaGateway.mockReset().mockImplementation(async ({ config }) => ({
resolvedConfig: config,
diagnostics: [],
}));
({ setActivePluginRegistry } = await import("../../plugins/runtime.js"));
({ createTestRegistry } = await import("../../test-utils/channel-plugins.js"));
({ createMessageTool } = await import("./message-tool.js"));
});
function createChannelPlugin(params: {

View File

@@ -1,5 +1,5 @@
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { markdownToSignalTextChunks } from "../../../extensions/signal/src/format.js";
import {
signalOutbound,
@@ -201,9 +201,11 @@ function expectSuccessfulWhatsAppInternalHookPayload(
}
describe("deliverOutboundPayloads", () => {
beforeEach(async () => {
vi.resetModules();
beforeAll(async () => {
({ deliverOutboundPayloads, normalizeOutboundPayloads } = await import("./deliver.js"));
});
beforeEach(() => {
setActivePluginRegistry(defaultRegistry);
mocks.appendAssistantMessageToSessionTranscript.mockClear();
hookMocks.runner.hasHooks.mockClear();

View File

@@ -1,4 +1,4 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import {
expectAugmentedCodexCatalog,
expectCodexBuiltInSuppression,
@@ -65,8 +65,7 @@ const MODEL: ProviderRuntimeModel = {
};
describe("provider-runtime", () => {
beforeEach(async () => {
vi.resetModules();
beforeAll(async () => {
({
augmentModelCatalogWithProviderPlugins,
buildProviderAuthDoctorHintWithPlugin,
@@ -91,6 +90,9 @@ describe("provider-runtime", () => {
runProviderDynamicModel,
wrapProviderStreamFn,
} = await import("./provider-runtime.js"));
});
beforeEach(() => {
resetProviderRuntimeHookCacheForTest();
resolvePluginProvidersMock.mockReset();
resolvePluginProvidersMock.mockReturnValue([]);