@@ -48,7 +48,7 @@ describe('OutputChannelLogger tests', () => {
4848 } ) ;
4949
5050 it ( 'should create a side log in the workspace area' , async ( ) => {
51- logger . setLogStoragePath ( tempFolders . storagePath . name , false ) ;
51+ await logger . setLogStoragePath ( tempFolders . storagePath . name , false ) ;
5252
5353 await logger . log ( 'xxx' , { additionalLogLocation : 'first' } ) ;
5454 await logger . log ( 'yyy' , { additionalLogLocation : 'second' } ) ;
@@ -65,7 +65,7 @@ describe('OutputChannelLogger tests', () => {
6565 } ) ;
6666
6767 it ( 'should delete side logs on dispose' , async ( ) => {
68- logger . setLogStoragePath ( tempFolders . storagePath . name , false ) ;
68+ await logger . setLogStoragePath ( tempFolders . storagePath . name , false ) ;
6969 await logger . log ( 'xxx' , { additionalLogLocation : 'first' } ) ;
7070 await logger . log ( 'yyy' , { additionalLogLocation : 'second' } ) ;
7171
@@ -80,7 +80,7 @@ describe('OutputChannelLogger tests', () => {
8080 } ) ;
8181
8282 it ( 'should not delete side logs on dispose in a custom directory' , async ( ) => {
83- logger . setLogStoragePath ( tempFolders . storagePath . name , true ) ;
83+ await logger . setLogStoragePath ( tempFolders . storagePath . name , true ) ;
8484 await logger . log ( 'xxx' , { additionalLogLocation : 'first' } ) ;
8585 await logger . log ( 'yyy' , { additionalLogLocation : 'second' } ) ;
8686
@@ -95,7 +95,7 @@ describe('OutputChannelLogger tests', () => {
9595 } ) ;
9696
9797 it ( 'should remove an additional log location' , async ( ) => {
98- logger . setLogStoragePath ( tempFolders . storagePath . name , false ) ;
98+ await logger . setLogStoragePath ( tempFolders . storagePath . name , false ) ;
9999 await logger . log ( 'xxx' , { additionalLogLocation : 'first' } ) ;
100100 await logger . log ( 'yyy' , { additionalLogLocation : 'second' } ) ;
101101
@@ -110,7 +110,7 @@ describe('OutputChannelLogger tests', () => {
110110 } ) ;
111111
112112 it ( 'should not remove an additional log location in a custom directory' , async ( ) => {
113- logger . setLogStoragePath ( tempFolders . storagePath . name , true ) ;
113+ await logger . setLogStoragePath ( tempFolders . storagePath . name , true ) ;
114114 await logger . log ( 'xxx' , { additionalLogLocation : 'first' } ) ;
115115 await logger . log ( 'yyy' , { additionalLogLocation : 'second' } ) ;
116116
@@ -126,17 +126,17 @@ describe('OutputChannelLogger tests', () => {
126126
127127 it ( 'should delete an existing folder when setting the log storage path' , async ( ) => {
128128 fs . createFileSync ( path . join ( tempFolders . storagePath . name , 'test-logger' , 'xxx' ) ) ;
129- logger . setLogStoragePath ( tempFolders . storagePath . name , false ) ;
129+ await logger . setLogStoragePath ( tempFolders . storagePath . name , false ) ;
130130 // should be empty dir
131131
132+ await waitABit ( ) ;
132133 const testLoggerFolder = path . join ( tempFolders . storagePath . name , 'test-logger' ) ;
133- // TODO: Why does this test pass? I'd expect the length to be 0 if it's correctly deleted the existing folder.
134- expect ( fs . readdirSync ( testLoggerFolder ) . length ) . to . equal ( 1 ) ;
134+ expect ( fs . existsSync ( testLoggerFolder ) ) . to . be . false ;
135135 } ) ;
136136
137137 it ( 'should not delete an existing folder when setting the log storage path for a custom directory' , async ( ) => {
138138 fs . createFileSync ( path . join ( tempFolders . storagePath . name , 'test-logger' , 'xxx' ) ) ;
139- logger . setLogStoragePath ( tempFolders . storagePath . name , true ) ;
139+ await logger . setLogStoragePath ( tempFolders . storagePath . name , true ) ;
140140 // should not be empty dir
141141
142142 const testLoggerFolder = path . join ( tempFolders . storagePath . name , 'test-logger' ) ;
0 commit comments