File tree Expand file tree Collapse file tree 6 files changed +68
-0
lines changed
packages/integration-tests/suites/public-api/setTags Expand file tree Collapse file tree 6 files changed +68
-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://public@dsn.ingest.sentry.io/1337' ,
7+ } ) ;
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 >
Original file line number Diff line number Diff line change 1+ Sentry . setTags ( {
2+ tag_1 : { } ,
3+ tag_2 : [ ] ,
4+ tag_3 : [ 'a' , new Map ( ) ] ,
5+ tag_4 : ( ) => { } ,
6+ } ) ;
7+
8+ Sentry . captureMessage ( 'non_primitives' ) ;
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 not accept non-primitive tags' , 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_primitives' ) ;
12+ expect ( eventData . tags ) . toMatchObject ( { } ) ;
13+ } ) ;
Original file line number Diff line number Diff line change 1+ Sentry . setTags ( {
2+ tag_1 : 'foo' ,
3+ tag_2 : Math . PI ,
4+ tag_3 : false ,
5+ tag_4 : null ,
6+ tag_5 : undefined ,
7+ tag_6 : - 1 ,
8+ } ) ;
9+
10+ Sentry . captureMessage ( 'primitive_tags' ) ;
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 set primitive tags' , async ( { getLocalTestPath, page } ) => {
7+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
8+
9+ const eventData = await getSentryRequest ( page , url ) ;
10+
11+ expect ( eventData . message ) . toBe ( 'primitive_tags' ) ;
12+ expect ( eventData . tags ) . toMatchObject ( {
13+ tag_1 : 'foo' ,
14+ tag_2 : 3.141592653589793 ,
15+ tag_3 : false ,
16+ tag_4 : null ,
17+ tag_6 : - 1 ,
18+ } ) ;
19+ } ) ;
You can’t perform that action at this time.
0 commit comments