@@ -55,13 +55,15 @@ test('../../lib/appenders/dateFile', (batch) => {
55
55
logger . info ( 'this should not be written to the file' ) ;
56
56
logger . warn ( 'this should be written to the file' ) ;
57
57
58
- t . teardown ( ( ) => { removeFile ( 'date-file-test.log' ) ; } ) ;
59
-
60
- fs . readFile ( path . join ( __dirname , 'date-file-test.log' ) , 'utf8' , ( err , contents ) => {
61
- t . include ( contents , ` this should be written to the file${ EOL } ` ) ;
62
- t . equal ( contents . indexOf ( 'this should not be written to the file' ) , - 1 ) ;
63
- t . end ( ) ;
58
+ log4js . shutdown ( ( ) => {
59
+ fs . readFile ( path . join ( __dirname , 'date-file-test.log' ) , 'utf8' , ( err , contents ) => {
60
+ t . include ( contents , `this should be written to the file ${ EOL } ` ) ;
61
+ t . equal ( contents . indexOf ( ' this should not be written to the file' ) , - 1 ) ;
62
+ t . end ( ) ;
63
+ } ) ;
64
64
} ) ;
65
+
66
+ t . teardown ( ( ) => { removeFile ( 'date-file-test.log' ) ; } ) ;
65
67
} ) ;
66
68
67
69
batch . test ( 'configure with options.alwaysIncludePattern' , ( t ) => {
@@ -96,13 +98,13 @@ test('../../lib/appenders/dateFile', (batch) => {
96
98
t . teardown ( ( ) => { removeFile ( `date-file-test${ thisTime } ` ) ; } ) ;
97
99
98
100
// wait for filesystem to catch up
99
- setTimeout ( ( ) => {
101
+ log4js . shutdown ( ( ) => {
100
102
fs . readFile ( path . join ( __dirname , `date-file-test${ thisTime } ` ) , 'utf8' , ( err , contents ) => {
101
103
t . include ( contents , 'this should be written to the file with the appended date' ) ;
102
104
t . include ( contents , 'this is existing data' , 'should not overwrite the file on open (issue #132)' ) ;
103
105
t . end ( ) ;
104
106
} ) ;
105
- } , 100 ) ;
107
+ } ) ;
106
108
} ) ;
107
109
108
110
batch . test ( 'should flush logs on shutdown' , ( t ) => {
0 commit comments