Skip to content

Commit 66f28a0

Browse files
committed
add native prop name test
1 parent 36e7a9c commit 66f28a0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/integrations/test/extraerrordata.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,25 @@ describe('ExtraErrorData()', () => {
133133
},
134134
});
135135
});
136+
137+
it('toJSON props should allow for usage of native names', () => {
138+
const error = new TypeError('foo') as ExtendedError;
139+
error.baz = 42;
140+
error.toJSON = function() {
141+
return {
142+
message: 'bar',
143+
};
144+
};
145+
146+
const enhancedEvent = extraErrorData.enhanceEventWithErrorData(event, {
147+
originalException: error,
148+
});
149+
150+
expect(enhancedEvent.contexts).toEqual({
151+
TypeError: {
152+
baz: 42,
153+
message: 'bar',
154+
},
155+
});
156+
});
136157
});

0 commit comments

Comments
 (0)