Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix: properly nullify error stacks (#836)
Andrey Lushnikov0c2a2e11fd1e
diff --git a/src/chromium/crProtocolHelper.ts b/src/chromium/crProtocolHelper.tsindex 24cd0717ba..4fbef2d7e7 100644--- a/src/chromium/crProtocolHelper.ts+++ b/src/chromium/crProtocolHelper.ts@@ -101,6 +101,7 @@ export function toConsoleMessageLocation(stackTrace: Protocol.Runtime.StackTraceexport function exceptionToError(exceptionDetails: Protocol.Runtime.ExceptionDetails): Error {const message = getExceptionMessage(exceptionDetails);const err = new Error(message);- err.stack = ''; // Don't report clientside error with a node stack attached+ // Don't report clientside error with a node stack attached+ err.stack = 'Error: ' + err.message; // Stack is supposed to contain error message as the first line.return err;}diff --git a/src/page.ts b/src/page.tsindex 75092a2923..32de48a3bc 100644--- a/src/page.ts+++ b/src/page.ts@@ -152,7 +152,8 @@ export class Page extends platform.EventEmitter {_didCrash() {const error = new Error('Page crashed!');- error.stack = '';+ // Do not report node.js stack.+ error.stack = 'Error: ' + error.message; // Stack is supposed to contain error message as the first line.this.emit('error', error);}diff --git a/src/webkit/wkPage.ts b/src/webkit/wkPage.tsindex 13629bb8b5..4c88459e10 100644--- a/src/webkit/wkPage.ts+++ b/src/webkit/wkPage.ts@@ -322,7 +322,7 @@ export class WKPage implements PageDelegate {}if (level === 'error' && source === 'javascript') {const error = new Error(text);- error.stack = '';+ error.stack = 'Error: ' + error.message; // Nullify stack. Stack is supposed to contain error message as the first line.this._page.emit(Events.Page.PageError, error);return;}