@@ -146,7 +146,7 @@ module.exports = function () {
146
146
it ( 'should allow file transforms to filter with a RegExp' , function ( ) {
147
147
var count = 0 , source = gobble ( 'tmp/foo' ) , task ;
148
148
149
- function checkFilter ( input ) {
149
+ function checkFilter ( input ) {
150
150
count ++ ;
151
151
return input ;
152
152
}
@@ -163,10 +163,33 @@ module.exports = function () {
163
163
} ) ;
164
164
} ) ;
165
165
166
+ it ( 'should allow file transforms to filter with a RegExp and an extension' , function ( ) {
167
+ var count = 0 , source = gobble ( 'tmp/foo' ) , task ;
168
+
169
+ function checkFilter ( input ) {
170
+ count ++ ;
171
+ return input ;
172
+ }
173
+ checkFilter . defaults = {
174
+ accept : / f o o \. m d / ,
175
+ ext : '.txt'
176
+ } ;
177
+
178
+ task = source . transform ( checkFilter ) . build ( {
179
+ dest : 'tmp/output'
180
+ } ) ;
181
+
182
+ return task . then ( function ( ) {
183
+ assert . equal ( count , 1 ) ;
184
+ assert . deepEqual ( sander . lsrSync ( 'tmp/output' ) . sort ( ) , [ 'foo.txt' , 'bar.md' , 'baz.md' ] . sort ( ) ) ;
185
+ assert . equal ( sander . readFileSync ( 'tmp/output/foo.txt' , { encoding : 'utf-8' } ) . trim ( ) , 'foo: this is some text' ) ;
186
+ } ) ;
187
+ } ) ;
188
+
166
189
it ( 'should skip files for file transforms which return null' , function ( ) {
167
190
var count = 0 , source = gobble ( 'tmp/foo' ) , task ;
168
191
169
- function nullFileTransform ( input ) {
192
+ function nullFileTransform ( input ) {
170
193
count ++ ;
171
194
return ~ input . indexOf ( 'foo' ) ? input : null ;
172
195
}
0 commit comments