fix: 替换所有测试文件的 rm 为 retryRm,修复 Windows EBUSY

This commit is contained in:
2026-06-11 23:38:02 +08:00
parent 3cac492e78
commit 15ad256d1e
10 changed files with 82 additions and 121 deletions

View File

@@ -1,5 +1,6 @@
import { describe, it, expect, beforeEach, afterEach } from "bun:test";
import { mkdir, writeFile, rm } from "node:fs/promises";
import { mkdir, writeFile } from "node:fs/promises";
import { retryRm } from "../helpers/cleanup.ts";
import { join } from "node:path";
import {
assembleDiscussPrompt,
@@ -18,7 +19,7 @@ beforeEach(async () => {
});
afterEach(async () => {
await rm(TMP_DIR, { recursive: true, force: true });
await retryRm(TMP_DIR);
});
describe("assembleDiscussPrompt", () => {

View File

@@ -1,5 +1,6 @@
import { describe, it, expect, beforeEach, afterEach } from "bun:test";
import { mkdir, writeFile, rm } from "node:fs/promises";
import { mkdir, writeFile } from "node:fs/promises";
import { retryRm } from "../helpers/cleanup.ts";
import { join } from "node:path";
import { loadConfig, findProjectRoot, getRuneDir, validateConfig } from "../../src/core/config.ts";
import { ConfigError } from "../../src/cli/errors.ts";
@@ -12,7 +13,7 @@ beforeEach(async () => {
});
afterEach(async () => {
await rm(TMP_DIR, { recursive: true, force: true });
await retryRm(TMP_DIR);
});
describe("findProjectRoot", () => {
@@ -188,7 +189,7 @@ describe("mergeConfig 保留 metadata", () => {
expect(config.metadata!.command).toBe("bunx @lanyuanxiaoyao/rune");
expect(config.stages.discuss!.prompt).toBe("自定义讨论");
} finally {
await rm(tmpDir, { recursive: true, force: true });
await retryRm(tmpDir);
}
});

View File

@@ -1,5 +1,6 @@
import { describe, it, expect, beforeEach, afterEach } from "bun:test";
import { mkdir, writeFile, rm } from "node:fs/promises";
import { mkdir, writeFile } from "node:fs/promises";
import { retryRm } from "../helpers/cleanup.ts";
import { join } from "node:path";
import { scanChanges, scanArchives } from "../../src/core/scanner.ts";
import type { RuneConfig } from "../../src/types.ts";
@@ -11,7 +12,7 @@ beforeEach(async () => {
});
afterEach(async () => {
await rm(TMP_DIR, { recursive: true, force: true });
await retryRm(TMP_DIR);
});
describe("scanChanges", () => {