File tree 1 file changed +18
-3
lines changed
1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change
1
+ import * as winston from "winston" ;
1
2
import { winstonHack } from "../winston" ;
2
3
import logger from "../../core/logger/index" ;
3
4
5
+ global . tswConfig = {
6
+ plugins : [ ] ,
7
+ winstonTransports : undefined
8
+ } ;
9
+
4
10
describe ( "test winstonHack env" , ( ) => {
5
11
test ( "test logger's winstonLogger when it hasn't hacked" , ( ) => {
6
12
expect ( logger . winstonLogger ) . toBe ( undefined ) ;
7
13
} ) ;
8
14
9
- global . tswConfig . winstonTransports = undefined ;
10
- winstonHack ( ) ;
11
15
test ( "test winstonHack while config without winstonTransports " , ( ) => {
12
- expect ( logger . winstonLogger . log ) . toBe ( undefined ) ;
16
+ winstonHack ( ) ;
17
+ expect ( logger . winstonLogger ) . toBe ( undefined ) ;
18
+ } ) ;
19
+
20
+
21
+ test ( "test winstonHack while config with Console Transports " , ( ) => {
22
+ global . tswConfig . winstonTransports = [
23
+ new winston . transports . Console ( )
24
+ ] ;
25
+
26
+ winstonHack ( ) ;
27
+ expect ( logger . winstonLogger . transports . length ) . toBe ( 1 ) ;
13
28
} ) ;
14
29
} ) ;
You can’t perform that action at this time.
0 commit comments