File tree Expand file tree Collapse file tree 5 files changed +42
-2
lines changed
integration-tests/suites/public-api/init Expand file tree Collapse file tree 5 files changed +42
-2
lines changed Original file line number Diff line number Diff line change 1+ /* eslint-disable no-console */
2+ import { ConsoleMessage , expect } from '@playwright/test' ;
3+
4+ import { sentryTest } from '../../../../utils/fixtures' ;
5+
6+ // Regression test against https://github.com/getsentry/sentry-javascript/issues/4558
7+ sentryTest ( 'should not change console output' , async ( { getLocalTestPath, page } ) => {
8+ const url = await getLocalTestPath ( { testDir : __dirname } ) ;
9+
10+ // https://playwright.dev/docs/api/class-page#page-event-console
11+ page . on ( 'console' , ( msg : ConsoleMessage ) => {
12+ expect ( msg . text ( ) ) . toEqual ( `hello world ${ msg . type ( ) } ` ) ;
13+ } ) ;
14+
15+ await page . goto ( url ) ;
16+
17+ await page . evaluate ( ( ) => console . log ( 'hello' , 'world' , 'log' ) ) ;
18+
19+ await page . evaluate ( ( ) => console . warn ( 'hello' , 'world' , 'warning' ) ) ;
20+
21+ await page . evaluate ( ( ) => console . debug ( 'hello' , 'world' , 'debug' ) ) ;
22+ } ) ;
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 @@ -72,7 +72,7 @@ export class CaptureConsole implements Integration {
7272
7373 // this fails for some browsers. :(
7474 if ( originalConsoleMethod ) {
75- originalConsoleMethod . call ( global . console , args ) ;
75+ originalConsoleMethod . apply ( global . console , args ) ;
7676 }
7777 } ) ;
7878 } ) ;
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ function instrumentConsole(): void {
122122
123123 // this fails for some browsers. :(
124124 if ( originalConsoleMethod ) {
125- originalConsoleMethod . call ( global . console , args ) ;
125+ originalConsoleMethod . apply ( global . console , args ) ;
126126 }
127127 } ;
128128 } ) ;
You can’t perform that action at this time.
0 commit comments