File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -763,6 +763,51 @@ describe('copy()', function() {
763763 } ) ;
764764 } ) ;
765765
766+ it ( 'should filter raw source paths via rawPathFilter' , function ( ) {
767+ var sourcePath = getSourcePath ( 'nested-directory' ) ;
768+ var receivedPaths = [ ] ;
769+ return copy (
770+ sourcePath ,
771+ getDestinationPath ( ) ,
772+ {
773+ rawPathFilter : function ( filePath ) {
774+ receivedPaths . push ( filePath ) ;
775+ var filename = path . basename ( filePath ) ;
776+ return ( filePath === path . join ( sourcePath , '1' ) ) || ( filename . charAt ( 0 ) !== '1' ) ;
777+ }
778+ }
779+ ) . then ( function ( results ) {
780+ assert . ok ( receivedPaths . length > 0 ) ;
781+ receivedPaths . forEach ( function ( filePath ) {
782+ assert . ok ( path . isAbsolute ( filePath ) ) ;
783+ assert . ok ( filePath . startsWith ( sourcePath ) ) ;
784+ } ) ;
785+ return getOutputFiles ( )
786+ . then ( function ( files ) {
787+ var actual , expected ;
788+ actual = files ;
789+ expected = {
790+ '1' : { } ,
791+ '2' : {
792+ '2-1' : {
793+ '2-1-a' : '2-1-a\n' ,
794+ '2-1-b' : '2-1-b\n'
795+ } ,
796+ '2-2' : {
797+ '2-2-a' : '2-2-a\n' ,
798+ '2-2-b' : '2-2-b\n'
799+ } ,
800+ '2-a' : '2-a\n' ,
801+ '2-b' : '2-b\n'
802+ } ,
803+ 'a' : 'a\n' ,
804+ 'b' : 'b\n'
805+ } ;
806+ assert . deepStrictEqual ( actual , expected ) ;
807+ } ) ;
808+ } ) ;
809+ } ) ;
810+
766811 it ( 'should filter output files via regular expression' , function ( ) {
767812 return copy (
768813 getSourcePath ( 'nested-directory' ) ,
You can’t perform that action at this time.
0 commit comments