Skip to content

Commit 81b8e4f

Browse files
thomasahleclaude
andcommitted
fix: strip ANSI codes before Vite ready detection in UVM smoke script
GitHub Actions sets FORCE_COLOR=1, which makes Vite output ANSI escape codes (bold) around the port number in the 'Local: http://...' line: http://127.0.0.1:\e[1m43173\e[22m/ This broke the text.includes(baseUrl) check — 'http://127.0.0.1:43173' never matched, so the script always timed out after 45s. Fix: strip ANSI sequences with /\x1b\[[0-9;]*m/g before matching. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 054a41f commit 81b8e4f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

scripts/repro-uvm-browser-worker-assert.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ function startViteDevServer(baseUrl, port) {
185185
const onData = (buf) => {
186186
const text = String(buf);
187187
output += text;
188-
if (!ready && text.includes('Local:') && text.includes(baseUrl)) {
188+
// Strip ANSI escape codes before matching — GitHub Actions sets FORCE_COLOR=1
189+
// which makes Vite bold the port number: `http://127.0.0.1:\e[1m43173\e[22m/`
190+
const plain = text.replace(/\x1b\[[0-9;]*m/g, '');
191+
if (!ready && plain.includes('Local:') && plain.includes(baseUrl)) {
189192
ready = true;
190193
clearTimeout(timer);
191194
resolve();

0 commit comments

Comments
 (0)