From 28041f6d18011dbcf118501940617f2367562b8f Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Mon, 9 Mar 2015 11:52:58 -0400 Subject: [PATCH] delete unwanted options from map transforms --- src/builtins/map.js | 3 +++ test/scenarios.js | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/builtins/map.js b/src/builtins/map.js index 1ea1352..f9bff2d 100644 --- a/src/builtins/map.js +++ b/src/builtins/map.js @@ -67,6 +67,9 @@ export default function map ( inputdir, outputdir, options ) { }; let transformOptions = assign( {}, options.fn.defaults, options.userOptions ); + + delete transformOptions.accept; + delete transformOptions.ext; result = options.fn.call( context, data.toString(), transformOptions ); } catch ( e ) { let err = createTransformError( e, src, filename, this.node ); diff --git a/test/scenarios.js b/test/scenarios.js index 1866089..4a99168 100644 --- a/test/scenarios.js +++ b/test/scenarios.js @@ -333,6 +333,28 @@ module.exports = function () { done(); }); }); + + it( 'should delete unwanted options from map transformers', function ( done ) { + var source = gobble( 'tmp/foo' ); + + task = source.transform( checkOptions ).serve(); + + function checkOptions ( code, options ) { + assert.ok( !options.accept ); + assert.ok( !options.ext ); + + return code; + } + + checkOptions.defaults = { + accept: '.md', + ext: '.txt' + }; + + task.on( 'built', function () { + done(); + }); + }); });