11import { createLogger } from "../../src/sentry/logger" ;
22
33describe ( "Logger" , ( ) => {
4- const consoleLogSpy = jest . spyOn ( console , "log " ) . mockImplementation ( ( ) => undefined ) ;
4+ const consoleErrorSpy = jest . spyOn ( console , "error " ) . mockImplementation ( ( ) => undefined ) ;
55
66 afterEach ( ( ) => {
7- consoleLogSpy . mockReset ( ) ;
7+ consoleErrorSpy . mockReset ( ) ;
88 } ) ;
99
1010 it . each ( [
@@ -17,7 +17,7 @@ describe("Logger", () => {
1717
1818 logger [ loggerMethod ] ( "Hey!" ) ;
1919
20- expect ( consoleLogSpy ) . toHaveBeenCalledWith ( `[some-prefix] ${ logLevel } : Hey!` ) ;
20+ expect ( consoleErrorSpy ) . toHaveBeenCalledWith ( `[some-prefix] ${ logLevel } : Hey!` ) ;
2121 } ) ;
2222
2323 it . each ( [
@@ -30,7 +30,7 @@ describe("Logger", () => {
3030
3131 logger [ loggerMethod ] ( "Hey!" , "this" , "is" , "a test with" , 5 , "params" ) ;
3232
33- expect ( consoleLogSpy ) . toHaveBeenCalledWith (
33+ expect ( consoleErrorSpy ) . toHaveBeenCalledWith (
3434 `[some-prefix] ${ logLevel } : Hey!` ,
3535 "this" ,
3636 "is" ,
@@ -46,7 +46,7 @@ describe("Logger", () => {
4646
4747 logger . debug ( "Hey!" ) ;
4848
49- expect ( consoleLogSpy ) . toHaveBeenCalledWith ( `[some-prefix] Debug: Hey!` ) ;
49+ expect ( consoleErrorSpy ) . toHaveBeenCalledWith ( `[some-prefix] Debug: Hey!` ) ;
5050 } ) ;
5151
5252 it ( ".debug() should log multiple params correctly" , ( ) => {
@@ -55,7 +55,7 @@ describe("Logger", () => {
5555
5656 logger . debug ( "Hey!" , "this" , "is" , "a test with" , 5 , "params" ) ;
5757
58- expect ( consoleLogSpy ) . toHaveBeenCalledWith (
58+ expect ( consoleErrorSpy ) . toHaveBeenCalledWith (
5959 `[some-prefix] Debug: Hey!` ,
6060 "this" ,
6161 "is" ,
@@ -72,7 +72,7 @@ describe("Logger", () => {
7272
7373 logger [ loggerMethod ] ( "Hey!" ) ;
7474
75- expect ( consoleLogSpy ) . not . toHaveBeenCalled ( ) ;
75+ expect ( consoleErrorSpy ) . not . toHaveBeenCalled ( ) ;
7676 } ) ;
7777 } ) ;
7878
@@ -82,6 +82,6 @@ describe("Logger", () => {
8282
8383 logger . debug ( "Hey!" ) ;
8484
85- expect ( consoleLogSpy ) . not . toHaveBeenCalled ( ) ;
85+ expect ( consoleErrorSpy ) . not . toHaveBeenCalled ( ) ;
8686 } ) ;
8787} ) ;
0 commit comments