File tree Expand file tree Collapse file tree 4 files changed +53
-2
lines changed Expand file tree Collapse file tree 4 files changed +53
-2
lines changed Original file line number Diff line number Diff line change 5353 "fix" : " run-s fix:eslint fix:prettier" ,
5454 "fix:prettier" : " prettier --write \" {src,test}/**/*.ts\" " ,
5555 "fix:eslint" : " eslint . --format stylish --fix" ,
56+ "test" : " jest" ,
57+ "test:watch" : " jest --watch" ,
5658 "pack" : " npm pack"
5759 },
5860 "volta" : {
5961 "extends" : " ../../package.json"
6062 },
63+ "jest" : {
64+ "collectCoverage" : true ,
65+ "transform" : {
66+ "^.+\\ .ts$" : " ts-jest"
67+ },
68+ "moduleFileExtensions" : [
69+ " js" ,
70+ " ts"
71+ ],
72+ "testEnvironment" : " jsdom" ,
73+ "testMatch" : [
74+ " **/*.test.ts"
75+ ],
76+ "globals" : {
77+ "ts-jest" : {
78+ "tsConfig" : " ./tsconfig.json" ,
79+ "diagnostics" : false
80+ }
81+ }
82+ },
6183 "sideEffects" : false
6284}
Original file line number Diff line number Diff line change 1+ import { SDK_VERSION } from '@sentry/browser' ;
2+ import { setSDKInfo } from '@sentry/utils' ;
3+
14export * from '@sentry/browser' ;
25export { createErrorHandler , ErrorHandlerOptions } from './errorhandler' ;
36export {
@@ -8,3 +11,5 @@ export {
811 TraceDirective ,
912 TraceService ,
1013} from './tracing' ;
14+
15+ setSDKInfo ( 'sentry.javascript.angular' , 'npm:@sentry/angular' , SDK_VERSION ) ;
Original file line number Diff line number Diff line change 1+ import { getGlobalObject } from '@sentry/utils' ;
2+
3+ import * as Sentry from '../src/index' ;
4+
5+ const global = getGlobalObject < Window > ( ) ;
6+
7+ describe ( 'global SDK metadata' , ( ) => {
8+ it ( 'sets correct SDK data' , ( ) => {
9+ // the SDK data is set when we import from (and therefore run) `../src/index.ts` - it sets the angular part itself,
10+ // and the browser part gets set when it imports from @sentry /browser - so no action is necessary here before we run
11+ // the `expect`s
12+
13+ expect ( global . __SENTRY__ ?. sdkInfo ) . toBeDefined ( ) ;
14+ expect ( global . __SENTRY__ ?. sdkInfo ?. name ) . toEqual ( 'sentry.javascript.angular' ) ;
15+ expect ( global . __SENTRY__ ?. sdkInfo ?. version ) . toEqual ( Sentry . SDK_VERSION ) ;
16+ expect ( global . __SENTRY__ ?. sdkInfo ?. packages ) . toEqual (
17+ expect . arrayContaining ( [
18+ { name : 'npm:@sentry/angular' , version : Sentry . SDK_VERSION } ,
19+ { name : 'npm:@sentry/browser' , version : Sentry . SDK_VERSION } ,
20+ ] ) ,
21+ ) ;
22+ } ) ;
23+ } ) ;
Original file line number Diff line number Diff line change 11{
22 "extends" : " ./tsconfig.build.json" ,
3- "include" : [" src/**/*.ts" ],
3+ "include" : [" src/**/*.ts" , " test/**/*.ts " ],
44 "exclude" : [" dist" ],
55 "compilerOptions" : {
6- "rootDir" : " ."
6+ "rootDir" : " ." ,
7+ "types" : [" jest" ]
78 }
89}
You can’t perform that action at this time.
0 commit comments