From 1c59fac0b770b821bd84bb7cef43dcfb195349bb Mon Sep 17 00:00:00 2001 From: James Mortensen Date: Sat, 8 Jul 2023 12:34:00 +0530 Subject: [PATCH] fixes #4994 - Preserves error.name during serialization process so type of error can be used by reporters who differentiate between failed tests and broken tests, such as allure-mocha --- lib/nodejs/serializer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/nodejs/serializer.js b/lib/nodejs/serializer.js index b25c493bf0..f0e1733a16 100644 --- a/lib/nodejs/serializer.js +++ b/lib/nodejs/serializer.js @@ -204,7 +204,8 @@ class SerializableEvent { value = Object.assign(Object.create(null), value, { stack: value.stack, message: value.message, - __type: 'Error' + __type: 'Error', + name: value.name }); parent[key] = value; // after this, set the result of type(value) to be `object`, and we'll throw