mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
test: increase coverage for internal/error_serdes.js
test serializeError with getter property Refs: https://coverage.nodejs.org/coverage-73a21e4c06d5781d/lib/internal/error_serdes.js.html#L49 PR-URL: https://github.com/nodejs/node/pull/36628 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
1 parent
0b6d3070a1
commit
c27efd4e6b
1 file changed
+17
@@ -49,3 +49,20 @@ assert.strictEqual(cycle(Function), '[Function: Function]');
|
||||
assert.strictEqual(err.name, 'TypeError');
|
||||
assert.strictEqual(err.code, 'ERR_INVALID_ARG_TYPE');
|
||||
}
|
||||
|
||||
{
|
||||
let called = false;
|
||||
class DynamicError extends Error {
|
||||
get type() {
|
||||
called = true;
|
||||
return 'dynamic';
|
||||
}
|
||||
|
||||
get shouldIgnoreError() {
|
||||
throw new Error();
|
||||
}
|
||||
}
|
||||
|
||||
serializeError(new DynamicError());
|
||||
assert.deepStrictEqual(called, true);
|
||||
}
|
||||
Reference in new issue
Block a user