File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -8,14 +8,27 @@ jest.mock('./report-v3', () => ({
8
8
}
9
9
} ) )
10
10
11
- describe ( 'test logger' , ( ) => {
12
- const logMessage : unknown [ ] = [ ]
13
- const warnMessage : unknown [ ] = [ ]
14
- const errorMessage : unknown [ ] = [ ]
11
+ const originalLog = console . log
12
+ const originalWarn = console . warn
13
+ const originalError = console . error
14
+
15
+ const logMessage : unknown [ ] = [ ]
16
+ const warnMessage : unknown [ ] = [ ]
17
+ const errorMessage : unknown [ ] = [ ]
18
+
19
+ beforeAll ( ( ) => {
15
20
console . log = jest . fn ( ( ...args : unknown [ ] ) => logMessage . push ( ...args ) )
16
21
console . warn = jest . fn ( ( ...args : unknown [ ] ) => warnMessage . push ( ...args ) )
17
22
console . error = jest . fn ( ( ...args : unknown [ ] ) => errorMessage . push ( ...args ) )
23
+ } )
18
24
25
+ afterAll ( ( ) => {
26
+ console . log = originalLog
27
+ console . warn = originalWarn
28
+ console . error = originalError
29
+ } )
30
+
31
+ describe ( 'test logger' , ( ) => {
19
32
test ( 'test level' , ( ) => {
20
33
const infoLogger = new Logger ( '' , true , 'INFO' )
21
34
infoLogger . info ( 'test1' )
You can’t perform that action at this time.
0 commit comments