test(memory): clear browser and plugin caches between cases

This commit is contained in:
Vincent Koc
2026-03-24 10:04:44 -07:00
parent ba95d43e3c
commit 7eefddd0ed
3 changed files with 12 additions and 2 deletions

View File

@@ -22,7 +22,9 @@ beforeEach(async () => {
await import("./server-context.remote-tab-ops.harness.js"));
});
afterEach(() => {
afterEach(async () => {
const { closePlaywrightBrowserConnection } = await import("./pw-session.js");
await closePlaywrightBrowserConnection().catch(() => {});
globalThis.fetch = originalFetch;
vi.restoreAllMocks();
});

View File

@@ -15,7 +15,9 @@ import {
originalFetch,
} from "./server-context.remote-tab-ops.harness.js";
afterEach(() => {
afterEach(async () => {
const { closePlaywrightBrowserConnection } = await import("./pw-session.js");
await closePlaywrightBrowserConnection().catch(() => {});
globalThis.fetch = originalFetch;
vi.restoreAllMocks();
});

View File

@@ -27,6 +27,8 @@ import {
} from "../../../extensions/whatsapp/src/directory-config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { LineProbeResult } from "../../plugin-sdk/line.js";
import { clearPluginDiscoveryCache } from "../../plugins/discovery.js";
import { clearPluginManifestRegistryCache } from "../../plugins/manifest-registry.js";
import { setActivePluginRegistry } from "../../plugins/runtime.js";
import {
createChannelTestPluginBase,
@@ -76,6 +78,8 @@ describe("channel plugin registry", () => {
afterEach(() => {
setActivePluginRegistry(emptyRegistry);
clearPluginDiscoveryCache();
clearPluginManifestRegistryCache();
});
it("sorts channel plugins by configured order", () => {
@@ -616,6 +620,8 @@ describe("channel plugin loader", () => {
afterEach(() => {
setActivePluginRegistry(emptyRegistry);
clearPluginDiscoveryCache();
clearPluginManifestRegistryCache();
});
it("loads channel plugins from the active registry", async () => {