10000 switch react to use `captureException` from `@sentry/core` · jonator/sentry-javascript@5399009 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5399009

Browse files
committed
switch react to use captureException from @sentry/core
1 parent cfc400c commit 5399009

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

packages/react/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
},
1818
"dependencies": {
1919
"@sentry/browser": "7.24.2",
20+
"@sentry/core": "7.24.2",
2021
"@sentry/types": "7.24.2",
2122
"@sentry/utils": "7.24.2",
2223
"hoist-non-react-statics": "^3.3.2",

packages/react/src/errorboundary.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { captureException, ReportDialogOptions, Scope, showReportDialog, withScope } from '@sentry/browser';
1+
import { ReportDialogOptions, Scope, showReportDialog, withScope } from '@sentry/browser';
2+
import { captureException } from '@sentry/core';
23
import { isError, logger } from '@sentry/utils';
34
import hoistNonReactStatics from 'hoist-non-react-statics';
45
import * as React from 'react';

packages/react/test/errorboundary.test.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,21 @@ const mockCaptureException = jest.fn();
1515
const mockShowReportDialog = jest.fn();
1616
const EVENT_ID = 'test-id-123';
1717

18-
jest.mock('@sentry/browser', () => {
19-
const actual = jest.requireActual('@sentry/browser');
18+
jest.mock('@sentry/core', () => {
19+
const actual = jest.requireActual('@sentry/core');
2020
return {
2121
...actual,
2222
captureException: (...args: unknown[]) => {
2323
mockCaptureException(...args);
2424
return EVENT_ID;
2525
},
26+
};
27+
});
28+
29+
jest.mock('@sentry/browser', () => {
30+
const actual = jest.requireActual('@sentry/browser');
31+
return {
32+
...actual,
2633
showReportDialog: (options: any) => {
2734
mockShowReportDialog(options);
2835
},

0 commit comments

Comments
 (0)
0