@@ -27,44 +27,23 @@ answers.find[path.normalize('/srcDir')] = [
2727 path . normalize ( '/srcDir/someOtherDir3' ) ,
2828] ;
2929runner . setAnswers ( answers ) ;
30-
31- fs . existsSync = ( itemPath : string ) => {
32- switch ( itemPath ) {
33- case path . normalize ( '/srcDir' ) :
34- case path . normalize ( '/srcDir/someOtherDir' ) :
35- case path . normalize ( '/srcDir/someOtherDir/file1.file' ) :
36- case path . normalize ( '/srcDir/someOtherDir/file2.file' ) :
37- case path . normalize ( '/srcDir/someOtherDir2' ) :
38- case path . normalize ( '/srcDir/someOtherDir2/file1.file' ) :
39- case path . normalize ( '/srcDir/someOtherDir2/file2.file' ) :
40- case path . normalize ( '/srcDir/someOtherDir2/file3.file' ) :
41- case path . normalize ( '/srcDir/someOtherDir3' ) :
42- return true ;
43- default :
44- return false ;
45- }
46- }
47-
48- fs . statSync = ( itemPath : string ) => {
49- const itemStats : fs . Stats = new fs . Stats ( ) ;
30+ runner . registerMockExport ( 'stats' , ( itemPath : string ) => {
31+ console . log ( '##vso[task.debug]stats ' + itemPath ) ;
5032 switch ( itemPath ) {
5133 case path . normalize ( '/srcDir/someOtherDir' ) :
5234 case path . normalize ( '/srcDir/someOtherDir2' ) :
5335 case path . normalize ( '/srcDir/someOtherDir3' ) :
54- itemStats . isDirectory = ( ) => true ;
55- break ;
36+ return { isDirectory : ( ) => true } ;
5637 case path . normalize ( '/srcDir/someOtherDir/file1.file' ) :
5738 case path . normalize ( '/srcDir/someOtherDir/file2.file' ) :
5839 case path . normalize ( '/srcDir/someOtherDir2/file1.file' ) :
5940 case path . normalize ( '/srcDir/someOtherDir2/file2.file' ) :
6041 case path . normalize ( '/srcDir/someOtherDir2/file3.file' ) :
61- itemStats . isDirectory = ( ) => false ;
62- break ;
42+ return { isDirectory : ( ) => false } ;
6343 default :
6444 throw { code : 'ENOENT' } ;
6545 }
66- return itemStats ;
67- }
46+ } ) ;
6847
6948// as a precaution, disable fs.chmodSync. it should not be called during this scenario.
7049fs . chmodSync = null ;
0 commit comments