From 99ca1dbc75d8fb8a2d0b6a1ca12c54941f40a524 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Fri, 19 Dec 2025 10:14:34 -0500 Subject: [PATCH] test: remove control characters from puppeteer serve output in E2E tests Ensures that ANSI color codes do not interfere with URL matching in the Puppeteer E2E utility by using 'NO_COLOR' and removing control characters from the stdout. --- tests/e2e/utils/puppeteer.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/e2e/utils/puppeteer.ts b/tests/e2e/utils/puppeteer.ts index af6b18278c3c..8cab9f2ddef6 100644 --- a/tests/e2e/utils/puppeteer.ts +++ b/tests/e2e/utils/puppeteer.ts @@ -1,5 +1,6 @@ import { type Page, launch } from 'puppeteer'; import { execAndWaitForOutputToMatch, killAllProcesses } from './process'; +import { stripVTControlCharacters } from 'node:util'; export interface BrowserTestOptions { project?: string; @@ -25,8 +26,11 @@ export async function executeBrowserTest(options: BrowserTestOptions = {}) { serveArgs.push(`--configuration=${options.configuration}`); } - const { stdout } = await execAndWaitForOutputToMatch('ng', serveArgs, match); - url = stdout.match(match)?.[1]; + const { stdout } = await execAndWaitForOutputToMatch('ng', serveArgs, match, { + ...process.env, + 'NO_COLOR': '1', + }); + url = stripVTControlCharacters(stdout).match(match)?.[1]; if (!url) { throw new Error('Could not find serving URL'); }