@@ -667,6 +667,59 @@ function runTests(baseopts) {
667
667
} ) ;
668
668
} ) ) ;
669
669
} ) ;
670
+ it ( 'should treat glob-like directory names as literal directory names when globbing is disabled' , function ( done ) {
671
+ options . disableGlobbing = true ;
672
+ var spy = sinon . spy ( ) ;
673
+ var filePath = getFixturePath ( 'nota[glob]/a.txt' ) ;
674
+ var watchPath = getFixturePath ( 'nota[glob]' ) ;
675
+ var matchingDir = getFixturePath ( 'notag' ) ;
676
+ var matchingFile = getFixturePath ( 'notag/b.txt' ) ;
677
+ var matchingFile2 = getFixturePath ( 'notal' ) ;
678
+ fs . mkdirSync ( watchPath , 0x1ed ) ;
679
+ fs . writeFileSync ( filePath , 'b' ) ;
680
+ fs . mkdirSync ( matchingDir , 0x1ed ) ;
681
+ fs . writeFileSync ( matchingFile , 'c' ) ;
682
+ fs . writeFileSync ( matchingFile2 , 'd' ) ;
683
+ watcher = chokidar . watch ( watchPath , options )
684
+ . on ( 'all' , spy )
685
+ . on ( 'ready' , function ( ) {
686
+ spy . should . have . been . calledWith ( 'add' , filePath ) ;
687
+ spy . should . not . have . been . calledWith ( 'addDir' , matchingDir ) ;
688
+ spy . should . not . have . been . calledWith ( 'add' , matchingFile ) ;
689
+ spy . should . not . have . been . calledWith ( 'add' , matchingFile2 ) ;
690
+ w ( fs . writeFile . bind ( fs , filePath , Date . now ( ) , simpleCb ) ) ( ) ;
691
+ waitFor ( [ spy . withArgs ( 'change' , filePath ) ] , function ( ) {
692
+ spy . should . have . been . calledWith ( 'change' , filePath ) ;
693
+ done ( ) ;
694
+ } ) ;
695
+ } ) ;
696
+ } ) ;
697
+ it ( 'should treat glob-like filenames as literal filenames when globbing is disabled' , function ( done ) {
698
+ options . disableGlobbing = true ;
699
+ var spy = sinon . spy ( ) ;
700
+ var filePath = getFixturePath ( 'nota[glob]' ) ;
701
+ var watchPath = getFixturePath ( 'nota[glob]' ) ;
702
+ var matchingDir = getFixturePath ( 'notag' ) ;
703
+ var matchingFile = getFixturePath ( 'notag/a.txt' ) ;
704
+ var matchingFile2 = getFixturePath ( 'notal' ) ;
705
+ fs . writeFileSync ( filePath , 'b' ) ;
706
+ fs . mkdirSync ( matchingDir , 0x1ed ) ;
707
+ fs . writeFileSync ( matchingFile , 'c' ) ;
708
+ fs . writeFileSync ( matchingFile2 , 'd' ) ;
709
+ watcher = chokidar . watch ( watchPath , options )
710
+ . on ( 'all' , spy )
711
+ . on ( 'ready' , function ( ) {
712
+ spy . should . have . been . calledWith ( 'add' , filePath ) ;
713
+ spy . should . not . have . been . calledWith ( 'addDir' , matchingDir ) ;
714
+ spy . should . not . have . been . calledWith ( 'add' , matchingFile ) ;
715
+ spy . should . not . have . been . calledWith ( 'add' , matchingFile2 ) ;
716
+ w ( fs . writeFile . bind ( fs , filePath , Date . now ( ) , simpleCb ) ) ( ) ;
717
+ waitFor ( [ spy . withArgs ( 'change' , filePath ) ] , function ( ) {
718
+ spy . should . have . been . calledWith ( 'change' , filePath ) ;
719
+ done ( ) ;
720
+ } ) ;
721
+ } ) ;
722
+ } ) ;
670
723
it ( 'should not prematurely filter dirs against complex globstar patterns' , function ( done ) {
671
724
var spy = sinon . spy ( ) ;
672
725
var deepFile = getFixturePath ( 'subdir/subsub/subsubsub/a.txt' ) ;
0 commit comments