Skip to content

Commit

Permalink
test: increase coverage for internal/error_serdes.js
Browse files Browse the repository at this point in the history
test serializeError with getter property

Refs: https://coverage.nodejs.org/coverage-73a21e4c06d5781d/lib/internal/error_serdes.js.html#L49

PR-URL: #36628
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
Lxxyx authored and targos committed May 1, 2021
1 parent 38921b3 commit 35c388a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/parallel/test-error-serdes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 35c388a

Please sign in to comment.