-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(react): Add React version to events (#12390)
Given React 19 has changes with error handling, we may want to treat it differently in the product. (see https://www.notion.so/sentry/React-JS-19-23a7a2c5f88d4ef59a4b9647c84333a3?d=98df57f2272d482fa12a3c0618b43fc4#9bb5d5f0a9604508bb290fd7405fcce0 as an example). To make this easier, we now attach the react version as context on all outgoing events.
- Loading branch information
1 parent
ce3e605
commit a08335d
Showing
4 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as SentryBrowser from '@sentry/browser'; | ||
import { version } from 'react'; | ||
import { init } from '../src/sdk'; | ||
|
||
describe('init', () => { | ||
it('sets the React version (if available) in the global scope', () => { | ||
const setContextSpy = jest.spyOn(SentryBrowser, 'setContext'); | ||
|
||
init({}); | ||
|
||
expect(setContextSpy).toHaveBeenCalledTimes(1); | ||
expect(setContextSpy).toHaveBeenCalledWith('react', { version }); | ||
}); | ||
}); |