Skip to content

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

chore: introduce env.PLAYWRIGHT_DISABLE_SERVICE_WORKER_CONSOLE to opt out (#38261)

Dmitry Gozmana8728d9acfb3
diff --git a/packages/playwright-core/src/server/chromium/crServiceWorker.ts b/packages/playwright-core/src/server/chromium/crServiceWorker.ts
index cb3df4a684..ee22505b96 100644
--- a/packages/playwright-core/src/server/chromium/crServiceWorker.ts
+++ b/packages/playwright-core/src/server/chromium/crServiceWorker.ts
@@ -52,7 +52,7 @@ export class CRServiceWorker extends Worker {
}
session.on('Runtime.consoleAPICalled', event => {
- if (!this.existingExecutionContext)
+ if (!this.existingExecutionContext || process.env.PLAYWRIGHT_DISABLE_SERVICE_WORKER_CONSOLE)
return;
const args = event.args.map(o => createHandle(this.existingExecutionContext!, o));
const message = new ConsoleMessage(null, this, event.type, undefined, args, toConsoleMessageLocation(event.stackTrace));