Skip to content

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

fix: Jest isError handling to work with TypeError (#7251)

Max Schmitt143689e34f65
diff --git a/src/protocol/serializers.ts b/src/protocol/serializers.ts
index a324bb30c9..e48e180d45 100644
--- a/src/protocol/serializers.ts
+++ b/src/protocol/serializers.ts
@@ -151,5 +151,5 @@ function isDate(obj: any): obj is Date {
}
function isError(obj: any): obj is Error {
- return obj instanceof Error || (obj && obj.__proto__ && obj.__proto__.name === 'Error');
+ return obj instanceof Error || obj?.__proto__?.name === 'Error' || (obj?.__proto__ && isError(obj.__proto__));
}