diff --git a/lib/svgo/config.js b/lib/svgo/config.js index f26e3ed88..4fb384e4c 100644 --- a/lib/svgo/config.js +++ b/lib/svgo/config.js @@ -59,7 +59,7 @@ exports.defaultPlugins = defaultPlugins; const extendDefaultPlugins = (plugins) => { const extendedPlugins = pluginsOrder.map((name) => ({ name, - ...pluginsMap[name], + active: pluginsMap[name].active, })); for (const plugin of plugins) { const resolvedPlugin = resolvePluginConfig(plugin, {}); diff --git a/test/config/_index.js b/test/config/_index.js index 9a77fc2a4..3dae6d485 100644 --- a/test/config/_index.js +++ b/test/config/_index.js @@ -190,6 +190,18 @@ describe('config', function () { 'customPlugin' ); }); + it('should pass global floatPrecision when plugin one not specified', () => { + const convertPathDataPlugin = resolvePluginConfig( + extendedPlugins.find((item) => item.name === 'convertPathData'), + { floatPrecision: 1 } + ); + const convertTransformPlugin = resolvePluginConfig( + extendedPlugins.find((item) => item.name === 'convertTransform'), + {} + ); + expect(convertPathDataPlugin.params.floatPrecision).to.equal(1); + expect(convertTransformPlugin.params.floatPrecision).to.equal(3); + }); }); describe('config', () => {