Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(testrunner): console.log in color (#3633)

Joel Einbindera6b9922eb88f
diff --git a/test-runner/src/worker.ts b/test-runner/src/worker.ts
index 15c8ed2c6f..536c19eb31 100644
--- a/test-runner/src/worker.ts
+++ b/test-runner/src/worker.ts
@@ -16,11 +16,18 @@
import { initializeImageMatcher } from './expect';
import { TestRunner, fixturePool } from './testRunner';
+import { Console } from 'console';
let closed = false;
sendMessageToParent('ready');
+global.console = new Console({
+ stdout: process.stdout,
+ stderr: process.stderr,
+ colorMode: process.env.FORCE_COLOR === '1',
+});
+
process.stdout.write = chunk => {
if (testRunner && !closed)
testRunner.stdout(chunk);