@@ -504,6 +504,21 @@ describe('Replace in file', () => {
504
504
done ( ) ;
505
505
} ) ;
506
506
} ) ;
507
+
508
+ it ( 'should work without expanding globs if disabled' , done => {
509
+ replace ( {
510
+ files : [ 'test1' , 'test2' ] ,
511
+ from : / r e \s p l a c e / g,
512
+ to : 'b' ,
513
+ disableGlobs : true ,
514
+ } , ( ) => {
515
+ const test1 = fs . readFileSync ( 'test1' , 'utf8' ) ;
516
+ const test2 = fs . readFileSync ( 'test2' , 'utf8' ) ;
517
+ expect ( test1 ) . to . equal ( 'a b c' ) ;
518
+ expect ( test2 ) . to . equal ( 'a b c' ) ;
519
+ done ( ) ;
520
+ } ) ;
521
+ } ) ;
507
522
} ) ;
508
523
509
524
/**
@@ -714,6 +729,19 @@ describe('Replace in file', () => {
714
729
expect ( test2 ) . to . equal ( 'a b c' ) ;
715
730
} ) ;
716
731
732
+ it ( 'should support an array of ignored files' , ( ) => {
733
+ replace . sync ( {
734
+ files : 'test*' ,
735
+ ignore : [ 'test1' , 'test3' ] ,
736
+ from : / r e \s p l a c e / g,
737
+ to : 'b' ,
738
+ } ) ;
739
+ const test1 = fs . readFileSync ( 'test1' , 'utf8' ) ;
740
+ const test2 = fs . readFileSync ( 'test2' , 'utf8' ) ;
741
+ expect ( test1 ) . to . equal ( 'a re place c' ) ;
742
+ expect ( test2 ) . to . equal ( 'a b c' ) ;
743
+ } ) ;
744
+
717
745
it ( 'should not fail when the ignore parameter is undefined' , ( ) => {
718
746
replace . sync ( {
719
747
files : 'test*' ,
@@ -726,5 +754,18 @@ describe('Replace in file', () => {
726
754
expect ( test1 ) . to . equal ( 'a b c' ) ;
727
755
expect ( test2 ) . to . equal ( 'a b c' ) ;
728
756
} ) ;
757
+
758
+ it ( 'should work without expanding globs if disabled' , ( ) => {
759
+ replace . sync ( {
760
+ files : [ 'test1' , 'test2' ] ,
761
+ from : / r e \s p l a c e / g,
762
+ to : 'b' ,
763
+ disableGlobs : true ,
764
+ } ) ;
765
+ const test1 = fs . readFileSync ( 'test1' , 'utf8' ) ;
766
+ const test2 = fs . readFileSync ( 'test2' , 'utf8' ) ;
767
+ expect ( test1 ) . to . equal ( 'a b c' ) ;
768
+ expect ( test2 ) . to . equal ( 'a b c' ) ;
769
+ } ) ;
729
770
} ) ;
730
771
} ) ;
0 commit comments