Skip to content

Commit 716ef9d

Browse files
committed
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.
1 parent 424a465 commit 716ef9d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/e2e/utils/puppeteer.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { type Page, launch } from 'puppeteer';
22
import { execAndWaitForOutputToMatch, killAllProcesses } from './process';
3+
import { stripVTControlCharacters } from 'node:util';
34

45
export interface BrowserTestOptions {
56
project?: string;
@@ -25,8 +26,11 @@ export async function executeBrowserTest(options: BrowserTestOptions = {}) {
2526
serveArgs.push(`--configuration=${options.configuration}`);
2627
}
2728

28-
const { stdout } = await execAndWaitForOutputToMatch('ng', serveArgs, match);
29-
url = stdout.match(match)?.[1];
29+
const { stdout } = await execAndWaitForOutputToMatch('ng', serveArgs, match, {
30+
...process.env,
31+
'NO_COLOR': '1',
32+
});
33+
url = stripVTControlCharacters(stdout).match(match)?.[1];
3034
if (!url) {
3135
throw new Error('Could not find serving URL');
3236
}

0 commit comments

Comments
 (0)