From 5043b424cf0cd8f6ad014b511211d0afe43ced2f Mon Sep 17 00:00:00 2001 From: Justin Parker Date: Mon, 26 Oct 2026 20:46:03 -0700 Subject: [PATCH] Stop background git maintenance in test fixture repos and wait for the notepad to finish drawing before asserting, so npm test passes on CI runners AI Assisted --- scripts/skill-script-helpers.mjs | 5 +++++ scripts/test-web-console-page-notepad.mjs | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/skill-script-helpers.mjs b/scripts/skill-script-helpers.mjs index 121fa48..8402947 100644 --- a/scripts/skill-script-helpers.mjs +++ b/scripts/skill-script-helpers.mjs @@ -99,6 +99,11 @@ export function gitInit(dir, branch = "main") { g("config", "user.email", "t@example.com"); g("config", "user.name", "Test"); g("config", "commit.gpgsign", "false"); + // No background maintenance after a commit: on macOS it held + // .git/objects/maintenance.lock while copyFixture copied the template, and + // the copy failed with ENOENT once the lock was gone. + g("config", "maintenance.auto", "false"); + g("config", "gc.auto", "0"); return g; } diff --git a/scripts/test-web-console-page-notepad.mjs b/scripts/test-web-console-page-notepad.mjs index c7b8b08..4e7713a 100644 --- a/scripts/test-web-console-page-notepad.mjs +++ b/scripts/test-web-console-page-notepad.mjs @@ -348,15 +348,23 @@ test("headings grow, bullets draw, and marks come back on the line the cursor is return [...root.querySelectorAll(".cm-line")].map((l) => ({ text: l.textContent, size: parseFloat(getComputedStyle(l).fontSize) })); }); // The cursor starts on line 1 (the "# Big" heading): its mark shows, the - // second heading's does not. - let seen = await lines(); + // second heading's does not. The editor hides marks and draws bullets a + // little after the text lands, so wait for that before looking. + let seen; + await until(async () => { + seen = await lines(); + return seen[2]?.text === "Smaller" && seen[4] && !seen[4].text.startsWith("-"); + }, 5000); assert.equal(seen[0].text, "# Big"); assert.equal(seen[2].text, "Smaller", "off the cursor line the mark is hidden"); assert.ok(seen[0].size > seen[2].size && seen[2].size > seen[7].size, `heading sizes step down: ${seen.map((l) => l.size).join(", ")}`); assert.ok(seen[4].text.startsWith("•") || !seen[4].text.startsWith("-"), `a bullet is drawn, not a hyphen: "${seen[4].text}"`); // Click the second heading: its mark comes back. await s.page.locator("#notepad-editor .cm-h2").click(); - seen = await lines(); + await until(async () => { + seen = await lines(); + return seen[2].text === "## Smaller"; + }, 5000); assert.equal(seen[2].text, "## Smaller"); assert.equal(seen[0].text, "Big"); }); @@ -712,6 +720,8 @@ test("Delete asks twice, Escape backs out of either, and only the second confirm await s.page.click("#notepad-delete-go"); await until(() => !fs.existsSync(folder), 4000); await s.page.waitForFunction(() => document.querySelectorAll("#notepad-tabs .notepad-tab").length === 1); + // The strip redraws before the neighbor is marked selected. + await until(async () => (await selectedName(s)).length === 1, 4000); assert.deepEqual(await selectedName(s), ["Notes"]); assert.equal(await shows(s, "keep me"), "keep me"); assert.equal(listTabs(s.project).last, idOf(s, "Notes"), "the neighbor became the last tab");