diff --git a/package.json b/package.json index 9c6b2bfd..87f9bf77 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "api:baseline": "node scripts/api-baseline.mjs", "build": "node esbuild.config.mjs", "build:styles": "node scripts/build-styles.mjs", - "check": "concurrently --group --pad-prefix 'node:check:*' && node --run build", + "check": "node --run build && concurrently --group --pad-prefix 'node:check:*'", "check:biome": "biome check --diagnostic-level=warn --error-on-warnings", "check:css-usage": "node scripts/check-css-usage.mjs", "check:eslint": "eslint src manifest.json LICENSE --max-warnings=0", diff --git a/tests/scripts/development-scripts.test.ts b/tests/scripts/development-scripts.test.ts index 2cf10cd4..dc3e4e60 100644 --- a/tests/scripts/development-scripts.test.ts +++ b/tests/scripts/development-scripts.test.ts @@ -1,11 +1,17 @@ import { spawnSync } from "node:child_process"; -import { mkdir, mkdtemp, readdir, readFile, writeFile } from "node:fs/promises"; +import { mkdir, mkdtemp, readdir, readFile, rm, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; import path from "node:path"; import { pathToFileURL } from "node:url"; -import { describe, expect, it } from "vitest"; +import { afterEach, describe, expect, it } from "vitest"; const repoRoot = process.cwd(); +const tempWorkspaces = new Set(); + +afterEach(async () => { + await Promise.all([...tempWorkspaces].map((workspace) => rm(workspace, { recursive: true, force: true }))); + tempWorkspaces.clear(); +}); describe("development scripts", () => { it("fails style builds when CSS files are missing from the style order file", async () => { @@ -193,7 +199,9 @@ describe("development scripts", () => { }); async function tempWorkspace(): Promise { - return mkdtemp(path.join(tmpdir(), "codex-panel-scripts-")); + const workspace = await mkdtemp(path.join(tmpdir(), "codex-panel-scripts-")); + tempWorkspaces.add(workspace); + return workspace; } async function styleOrderFixture(): Promise { diff --git a/tests/scripts/grit-policy.test.mjs b/tests/scripts/grit-policy.test.mjs index b305cea1..9121caf4 100644 --- a/tests/scripts/grit-policy.test.mjs +++ b/tests/scripts/grit-policy.test.mjs @@ -1,11 +1,17 @@ import { spawnSync } from "node:child_process"; import { readFileSync } from "node:fs"; -import { mkdir, mkdtemp, readdir, writeFile } from "node:fs/promises"; +import { mkdir, mkdtemp, readdir, rm, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; import path from "node:path"; -import { describe, expect, it } from "vitest"; +import { afterEach, describe, expect, it } from "vitest"; const repoRoot = process.cwd(); +const tempWorkspaces = new Set(); + +afterEach(async () => { + await Promise.all([...tempWorkspaces].map((workspace) => rm(workspace, { recursive: true, force: true }))); + tempWorkspaces.clear(); +}); const biomeBin = path.join(repoRoot, "node_modules", ".bin", "biome"); const projectBiomeConfig = parseJsonc(readFileSync(path.join(repoRoot, "biome.jsonc"), "utf8")); const projectPluginEntries = projectBiomeConfig.plugins; @@ -1486,6 +1492,7 @@ export async function read(client: AppServerClient): Promise { async function tempBiomeWorkspace(plugins) { const cwd = await mkdtemp(path.join(tmpdir(), "codex-panel-grit-policy-")); + tempWorkspaces.add(cwd); await mkdir(cwd, { recursive: true }); await mkdir(path.join(cwd, "src/features/chat/domain/thread-stream"), { recursive: true }); await mkdir(path.join(cwd, "src/features/chat/application/state"), { recursive: true });