File tree Expand file tree Collapse file tree 6 files changed +91
-0
lines changed Expand file tree Collapse file tree 6 files changed +91
-0
lines changed Original file line number Diff line number Diff line change 1+ import * as Sentry from '@sentry/node' ;
2+
3+ Sentry . init ( {
4+ dsn :
'https://[email protected] /1337' , 5+ release : '1.0' ,
6+ } ) ;
7+
8+ Sentry . setExtra ( 'extra_1' , {
9+ foo : 'bar' ,
10+ baz : {
11+ qux : 'quux' ,
12+ } ,
13+ } ) ;
14+
15+ Sentry . setExtra ( 'extra_2' , false ) ;
16+
17+ Sentry . captureMessage ( 'multiple_extras' ) ;
Original file line number Diff line number Diff line change 1+ import { assertSentryEvent , getEventRequest , runServer } from '../../../../utils' ;
2+
3+ test ( 'should record multiple extras of different types' , async ( ) => {
4+ const url = await runServer ( __dirname ) ;
5+ const requestBody = await getEventRequest ( url ) ;
6+
7+ assertSentryEvent ( requestBody , {
8+ message : 'multiple_extras' ,
9+ extra : {
10+ extra_1 : { foo : 'bar' , baz : { qux : 'quux' } } ,
11+ extra_2 : false ,
12+ } ,
13+ } ) ;
14+ } ) ;
Original file line number Diff line number Diff line change 1+ import * as Sentry from '@sentry/node' ;
2+
3+ Sentry . init ( {
4+ dsn :
'https://[email protected] /1337' , 5+ release : '1.0' ,
6+ } ) ;
7+
8+ type Circular = {
9+ self ?: Circular ;
10+ } ;
11+
12+ const objCircular : Circular = { } ;
13+ objCircular . self = objCircular ;
14+
15+ Sentry . setExtra ( 'non_serializable' , objCircular ) ;
16+
17+ Sentry . captureMessage ( 'non_serializable' ) ;
Original file line number Diff line number Diff line change 1+ import { assertSentryEvent , getEventRequest , runServer } from '../../../../utils' ;
2+
3+ test ( 'should normalize non-serializable extra' , async ( ) => {
4+ const url = await runServer ( __dirname ) ;
5+ const requestBody = await getEventRequest ( url ) ;
6+
7+ assertSentryEvent ( requestBody , {
8+ message : 'non_serializable' ,
9+ extra : { } ,
10+ } ) ;
11+ } ) ;
Original file line number Diff line number Diff line change 1+ import * as Sentry from '@sentry/node' ;
2+
3+ Sentry . init ( {
4+ dsn :
'https://[email protected] /1337' , 5+ release : '1.0' ,
6+ } ) ;
7+
8+ Sentry . setExtra ( 'foo' , {
9+ foo : 'bar' ,
10+ baz : {
11+ qux : 'quux' ,
12+ } ,
13+ } ) ;
14+ Sentry . captureMessage ( 'simple_extra' ) ;
Original file line number Diff line number Diff line change 1+ import { assertSentryEvent , getEventRequest , runServer } from '../../../../utils' ;
2+
3+ test ( 'should set a simple extra' , async ( ) => {
4+ const url = await runServer ( __dirname ) ;
5+ const requestBody = await getEventRequest ( url ) ;
6+
7+ assertSentryEvent ( requestBody , {
8+ message : 'simple_extra' ,
9+ extra : {
10+ foo : {
11+ foo : 'bar' ,
12+ baz : {
13+ qux : 'quux' ,
14+ } ,
15+ } ,
16+ } ,
17+ } ) ;
18+ } ) ;
You can’t perform that action at this time.
0 commit comments