Clean temporary test workspaces and build before checks

This commit is contained in:
murashit 2026-07-10 12:50:37 +09:00
parent 7f09418f7c
commit 2a0fb96ce6
3 changed files with 21 additions and 6 deletions

View file

@ -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",

View file

@ -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<string>();
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<string> {
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<string> {

View file

@ -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<void> {
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 });