Strip ansi from playwright logs to make them more readable

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/28860/head
Michael Telatynski 2025-01-06 14:53:20 +00:00
parent eaca3f83d6
commit edefe02174
No known key found for this signature in database
GPG Key ID: A2B008A5F49F5D0D
2 changed files with 3 additions and 1 deletions

View File

@ -275,6 +275,7 @@
"rimraf": "^6.0.0",
"semver": "^7.5.2",
"source-map-loader": "^5.0.0",
"strip-ansi": "^7.1.0",
"stylelint": "^16.1.0",
"stylelint-config-standard": "^36.0.0",
"stylelint-scss": "^6.0.0",

View File

@ -7,6 +7,7 @@ Please see LICENSE files in the repository root for full details.
import { TestInfo } from "@playwright/test";
import { Readable } from "stream";
import stripAnsi from "strip-ansi";
export class ContainerLogger {
private logs: Record<string, string> = {};
@ -27,7 +28,7 @@ export class ContainerLogger {
if (testInfo.status !== "passed") {
for (const container in this.logs) {
await testInfo.attach(container, {
body: this.logs[container],
body: stripAnsi(this.logs[container]),
contentType: "text/plain",
});
}