@@ -272,7 +272,7 @@ describe('preprocessor', () => {
272272 thirdCallback ( 'error' )
273273 } )
274274
275- it ( 'should tbrow after 3 retries' , ( done ) => {
275+ it ( 'should throw after 3 retries' , ( done ) => {
276276 var injector = new di . Injector ( [ { } , emitterSetting ] )
277277
278278 var pp = m . createPreprocessor ( { '**/*.js' : [ ] } , null , injector )
@@ -288,7 +288,7 @@ describe('preprocessor', () => {
288288 } )
289289 } )
290290
291- it ( 'should not preprocess binary files' , ( done ) => {
291+ it ( 'should not preprocess binary files by default ' , ( done ) => {
292292 var fakePreprocessor = sinon . spy ( ( content , file , done ) => {
293293 done ( null , content )
294294 } )
@@ -310,6 +310,29 @@ describe('preprocessor', () => {
310310 } )
311311 } )
312312
313+ it ( 'should preprocess binary files if handleBinaryFiles=true' , ( done ) => {
314+ const fakePreprocessor = sinon . spy ( ( content , file , done ) => {
315+ done ( null , content )
316+ } )
317+ fakePreprocessor . handleBinaryFiles = true
318+
319+ var injector = new di . Injector ( [ {
320+ 'preprocessor:fake' : [ 'factory' , function ( ) { return fakePreprocessor } ]
321+ } , emitterSetting ] )
322+
323+ pp = m . createPreprocessor ( { '**/*' : [ 'fake' ] } , null , injector )
324+
325+ const file = { originalPath : '/some/photo.png' , path : 'path' }
326+
327+ pp ( file , ( err ) => {
328+ if ( err ) throw err
329+
330+ expect ( fakePreprocessor ) . to . have . been . calledOnce
331+ expect ( file . content ) . to . be . an . instanceof ( Buffer )
332+ done ( )
333+ } )
334+ } )
335+
313336 it ( 'should not preprocess binary files with capital letters in extension' , ( done ) => {
314337 var fakePreprocessor = sinon . spy ( ( content , file , done ) => {
315338 done ( null , content )
0 commit comments