Skip to content

Commit 9857892

Browse files
committed
add assertion to ensure the error is modified in place
1 parent fdae3d0 commit 9857892

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe('createError(status)', function () {
1212
})
1313

1414
describe('Extending Existing Errors with HTTP Properties', function () {
15-
it('should extend an existing error with HTTP properties without altering its prototype', function () {
15+
it('should extend existing error without altering its prototype or replacing the object', function () {
1616
var nativeError = new Error('This is a test error')
1717

1818
// Extend the error with HTTP semantics
@@ -26,6 +26,8 @@ describe('createError(status)', function () {
2626
assert(httpError instanceof Error)
2727

2828
assert.strictEqual(Object.getPrototypeOf(httpError), Error.prototype)
29+
30+
assert.strictEqual(nativeError, httpError)
2931
})
3032
})
3133

0 commit comments

Comments
 (0)