revert(test): restore session plugin cleanup

This commit is contained in:
Peter Steinberger
2026-07-07 06:14:43 -04:00
parent f14eb97ae7
commit 0d9329d3a2

View File

@@ -3,18 +3,14 @@
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { afterAll, afterEach, beforeAll, describe, expect, test, vi } from "vitest";
import { afterEach, beforeAll, describe, expect, test, vi } from "vitest";
import { writeAcpSessionMetaForMigration } from "../acp/runtime/session-meta.js";
import { resetConfigRuntimeState, setRuntimeConfigSnapshot } from "../config/config.js";
import type { OpenClawConfig } from "../config/config.js";
import { loadSessionStore, type SessionEntry } from "../config/sessions.js";
import { writeSessionStoreForTest } from "../config/sessions/test-helpers.js";
import { createEmptyPluginRegistry } from "../plugins/registry-empty.js";
import {
getActivePluginRegistry,
resetPluginRuntimeStateForTest,
setActivePluginRegistry,
} from "../plugins/runtime.js";
import { resetPluginRuntimeStateForTest, setActivePluginRegistry } from "../plugins/runtime.js";
import { withStateDirEnv } from "../test-helpers/state-dir-env.js";
import {
canonicalizeSpawnedByForAgent,
@@ -105,10 +101,8 @@ function expectFields(value: unknown, expected: Record<string, unknown>): void {
}
describe("gateway session utils", () => {
const emptyPluginRegistry = createEmptyPluginRegistry();
beforeAll(() => {
setActivePluginRegistry(emptyPluginRegistry);
setActivePluginRegistry(createEmptyPluginRegistry());
listSessionsFromStore({
cfg: createModelDefaultsConfig({ primary: "anthropic/claude-sonnet-4.6" }),
storePath: "",
@@ -123,16 +117,11 @@ describe("gateway session utils", () => {
opts: {},
});
resetConfigRuntimeState();
resetPluginRuntimeStateForTest();
});
afterEach(() => {
resetConfigRuntimeState();
if (getActivePluginRegistry() !== emptyPluginRegistry) {
setActivePluginRegistry(emptyPluginRegistry);
}
});
afterAll(() => {
resetPluginRuntimeStateForTest();
});