test: strip color output in ESM spec (#47185)

This commit is contained in:
David Sanders 2025-05-21 01:50:06 -07:00 committed by GitHub
commit 7112c592c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,6 +7,7 @@ import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';
import { pathToFileURL } from 'node:url';
import { stripVTControlCharacters } from 'node:util';
const runFixture = async (appPath: string, args: string[] = []) => {
const result = cp.spawn(process.execPath, [appPath, ...args], {
@ -27,8 +28,8 @@ const runFixture = async (appPath: string, args: string[] = []) => {
return {
code,
signal,
stdout: Buffer.concat(stdout).toString().trim(),
stderr: Buffer.concat(stderr).toString().trim()
stdout: stripVTControlCharacters(Buffer.concat(stdout).toString().trim()),
stderr: stripVTControlCharacters(Buffer.concat(stderr).toString().trim())
};
};