Skip to content

Commit 0cc9fdc

Browse files
committed
add native prop name test
1 parent 328ce71 commit 0cc9fdc

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

packages/integrations/test/extraerrordata.test.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe('ExtraErrorData()', () => {
114114
});
115115
});
116116

117-
it('toJSON props should have prioroty over directly assigned ones', () => {
117+
it('toJSON props should have priority over directly assigned ones', () => {
118118
const error = new TypeError('foo') as ExtendedError;
119119
error.baz = 42;
120120
error.toJSON = function() {
@@ -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)