test(root): reuse temp repo helper in clawhub release tests

This commit is contained in:
Vincent Koc 2026-04-06 05:38:33 +01:00
parent b62badd8a3
commit bcf6e89e90
1 changed files with 4 additions and 10 deletions

View File

@ -1,6 +1,5 @@
import { execFileSync } from "node:child_process";
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { mkdirSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import {
@ -12,16 +11,12 @@ import {
resolveSelectedClawHubPublishablePluginPackages,
type PublishablePluginPackage,
} from "../scripts/lib/plugin-clawhub-release.ts";
import { cleanupTempDirs, makeTempRepoRoot } from "./helpers/temp-repo.js";
const tempDirs: string[] = [];
afterEach(() => {
while (tempDirs.length > 0) {
const dir = tempDirs.pop();
if (dir) {
rmSync(dir, { recursive: true, force: true });
}
}
cleanupTempDirs(tempDirs);
});
describe("resolveChangedClawHubPublishablePluginPackages", () => {
@ -294,8 +289,7 @@ function createTempPluginRepo(
includeClawHubContract?: boolean;
} = {},
) {
const repoDir = mkdtempSync(join(tmpdir(), "openclaw-clawhub-release-"));
tempDirs.push(repoDir);
const repoDir = makeTempRepoRoot(tempDirs, "openclaw-clawhub-release-");
const extensionId = options.extensionId ?? "demo-plugin";
const extensionIds = [extensionId, ...(options.extraExtensionIds ?? [])];