File tree Expand file tree Collapse file tree 8 files changed +80
-0
lines changed Expand file tree Collapse file tree 8 files changed +80
-0
lines changed Original file line number Diff line number Diff line change
1
+ import * as Sentry from '@sentry/browser' ;
2
+
3
+ window . Sentry = Sentry ;
4
+
5
+ Sentry . init ( {
6
+ dsn :
'https://[email protected] /1337' ,
7
+ } ) ;
Original file line number Diff line number Diff line change
1
+ Sentry . setExtra ( 'extra_1' , {
2
+ foo : 'bar' ,
3
+ baz : {
4
+ qux : 'quux' ,
5
+ } ,
6
+ } ) ;
7
+
8
+ Sentry . setExtra ( 'extra_2' , false ) ;
9
+
10
+ Sentry . captureMessage ( 'multiple_extras' ) ;
Original file line number Diff line number Diff line change
1
+ import { expect } from '@playwright/test' ;
2
+
3
+ import { sentryTest } from '../../../../utils/fixtures' ;
4
+ import { getSentryRequest } from '../../../../utils/helpers' ;
5
+
6
+ sentryTest ( 'should record multiple extras of different types' , async ( { getLocalTestPath, page } ) => {
7
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
8
+
9
+ const eventData = await getSentryRequest ( page , url ) ;
10
+
11
+ expect ( eventData . message ) . toBe ( 'multiple_extras' ) ;
12
+ expect ( eventData . extra ) . toMatchObject ( { extra_1 : { foo : 'bar' , baz : { qux : 'quux' } } , extra_2 : false } ) ;
13
+ } ) ;
Original file line number Diff line number Diff line change
1
+ const el = document . querySelector ( 'body' ) ;
2
+
3
+ Sentry . setExtra ( 'non_serializable' , el ) ;
4
+
5
+ Sentry . captureMessage ( 'non_serializable' ) ;
Original file line number Diff line number Diff line change
1
+ import { expect } from '@playwright/test' ;
2
+
3
+ import { sentryTest } from '../../../../utils/fixtures' ;
4
+ import { getSentryRequest } from '../../../../utils/helpers' ;
5
+
6
+ sentryTest ( 'should normalize non-serializable extra' , async ( { getLocalTestPath, page } ) => {
7
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
8
+
9
+ const eventData = await getSentryRequest ( page , url ) ;
10
+
11
+ expect ( eventData . message ) . toBe ( 'non_serializable' ) ;
12
+ expect ( eventData . extra ) . toMatchObject ( { } ) ;
13
+ } ) ;
Original file line number Diff line number Diff line change
1
+ Sentry . setExtra ( 'simple_extra' , {
2
+ foo : 'bar' ,
3
+ baz : {
4
+ qux : 'quux' ,
5
+ } ,
6
+ } ) ;
7
+
8
+ Sentry . captureMessage ( 'simple_extra' ) ;
Original file line number Diff line number Diff line change
1
+ import { expect } from '@playwright/test' ;
2
+
3
+ import { sentryTest } from '../../../../utils/fixtures' ;
4
+ import { getSentryRequest } from '../../../../utils/helpers' ;
5
+
6
+ sentryTest ( 'should record a simple extra object' , async ( { getLocalTestPath, page } ) => {
7
+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
8
+
9
+ const eventData = await getSentryRequest ( page , url ) ;
10
+
11
+ expect ( eventData . message ) . toBe ( 'simple_extra' ) ;
12
+ expect ( eventData . extra ) . toMatchObject ( { simple_extra : { foo : 'bar' , baz : { qux : 'quux' } } } ) ;
13
+ } ) ;
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ <html >
3
+ <head >
4
+ <meta charset =" utf-8" />
5
+ <title ></title >
6
+ <script src =" {{ htmlWebpackPlugin.options.initialization }} " ></script >
7
+ </head >
8
+ <body >
9
+ <script src =" {{ htmlWebpackPlugin.options.subject }} " ></script >
10
+ </body >
11
+ </html >
You can’t perform that action at this time.
0 commit comments