test(plugins): share async temp helpers in marketplace tests

This commit is contained in:
Vincent Koc
2026-04-06 05:52:10 +01:00
parent f3f42e6bbf
commit ddea9a6c01
3 changed files with 52 additions and 33 deletions

View File

@@ -4,6 +4,10 @@ import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { OpenClawConfig } from "../config/config.js";
import { resolvePluginInstallDir } from "./install.js";
import {
cleanupTrackedTempDirsAsync,
makeTrackedTempDirAsync,
} from "./test-helpers/fs-fixtures.js";
import {
removePluginFromConfig,
resolveUninstallChannelConfigKeys,
@@ -597,13 +601,14 @@ describe("removePluginFromConfig", () => {
describe("uninstallPlugin", () => {
let tempDir: string;
const tempDirs: string[] = [];
beforeEach(async () => {
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "uninstall-test-"));
tempDir = await makeTrackedTempDirAsync("uninstall-test", tempDirs);
});
afterEach(async () => {
await fs.rm(tempDir, { recursive: true, force: true });
await cleanupTrackedTempDirsAsync(tempDirs);
});
it("returns error when plugin not found", async () => {