-
-
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.
chore(angular): Add Angular version to event contexts (#5260)
Query and send the Angular version in events to Sentry to let us know which Angular versions are used by our users
- Loading branch information
Showing
4 changed files
with
36 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const baseConfig = require('../../jest/jest.config.js'); | ||
|
||
module.exports = { | ||
...baseConfig, | ||
testEnvironment: 'jsdom', | ||
}; |
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,16 @@ | ||
import * as SentryBrowser from '@sentry/browser'; | ||
|
||
import { init } from '../src/sdk'; | ||
|
||
describe('init', () => { | ||
it('sets the Angular version (if available) in the global scope', () => { | ||
const setContextSpy = jest.spyOn(SentryBrowser, 'setContext'); | ||
|
||
init({}); | ||
|
||
// In our case, the Angular version is 10 because that's the version we use for compilation | ||
// (and hence the dependency version of Angular core we installed (see package.json)) | ||
expect(setContextSpy).toHaveBeenCalledTimes(1); | ||
expect(setContextSpy).toHaveBeenCalledWith('angular', { version: 10 }); | ||
}); | ||
}); |