An open source design system that's fully customizable and agent ready
TypeScript
test(cli): door-conformance removes each run's folder once it has read it (#9453)
Christopher Chedeau859df5f49e6b
diff --git a/packages/cli/host/door-conformance.test.mjs b/packages/cli/host/door-conformance.test.mjsindex 96cdcc4297..61aa365c97 100644--- a/packages/cli/host/door-conformance.test.mjs+++ b/packages/cli/host/door-conformance.test.mjs@@ -113,8 +113,9 @@ const FOLDERS = {},};-/** @type {string[]} */-const bases = [];+/** Run folders not yet removed: a run removes its own once it has read it. */+/** @type {Set<string>} */+const bases = new Set();/*** Every file under `root`, skipping node_modules, by path relative to `base`.@@ -144,7 +145,7 @@ function readTree(root, base, into = new Map()) {*/async function runThrough(door, argv, setUp) {const base = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-door-'));- bases.push(base);+ bases.add(base);const dir = path.join(base, 'app');const home = path.join(base, 'home');fs.mkdirSync(dir);@@ -208,6 +209,10 @@ async function runThrough(door, argv, setUp) {const placeholders = text =>text.split(real).join('<run>').split(base).join('<run>');const after = read();+ // The run's folder is read; it goes now, while the runs are spread over+ // the setup's own budget, rather than all of them at once after the file.+ fs.rmSync(base, {recursive: true, force: true});+ bases.delete(base);/** @type {Record<string, string | null>} */const changes = {};for (const [file, text] of after) {@@ -246,6 +251,7 @@ async function inBatches(tasks, limit) {const examples = await commandExamples();+// Only a run that failed before removing its folder leaves one here.afterAll(() => {for (const base of bases) fs.rmSync(base, {recursive: true, force: true});});