@@ -504,6 +504,21 @@ describe('Replace in file', () => {
504504 done ( ) ;
505505 } ) ;
506506 } ) ;
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+ } ) ;
507522 } ) ;
508523
509524 /**
@@ -714,6 +729,19 @@ describe('Replace in file', () => {
714729 expect ( test2 ) . to . equal ( 'a b c' ) ;
715730 } ) ;
716731
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+
717745 it ( 'should not fail when the ignore parameter is undefined' , ( ) => {
718746 replace . sync ( {
719747 files : 'test*' ,
@@ -726,5 +754,18 @@ describe('Replace in file', () => {
726754 expect ( test1 ) . to . equal ( 'a b c' ) ;
727755 expect ( test2 ) . to . equal ( 'a b c' ) ;
728756 } ) ;
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+ } ) ;
729770 } ) ;
730771} ) ;
0 commit comments