From 1a2d3dce26d813e96fc73860699b1bf22ccb5181 Mon Sep 17 00:00:00 2001 From: Bogdan Chadkin Date: Sat, 30 Jul 2016 14:08:31 +0300 Subject: [PATCH] Changde indent default to false --- src/utils/getIndentString.js | 2 +- test/cli/banner-intro-outro-footer/_config.js | 2 +- test/cli/module-name/_config.js | 2 +- test/cli/no-strict/_config.js | 2 +- test/cli/no-treeshake/_config.js | 2 +- test/test.js | 6 ++++++ 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/utils/getIndentString.js b/src/utils/getIndentString.js index 8ad7b55..5130ed8 100644 --- a/src/utils/getIndentString.js +++ b/src/utils/getIndentString.js @@ -1,5 +1,5 @@ export default function getIndentString ( magicString, options ) { - if ( !( 'indent' in options ) || options.indent === true ) { + if ( options.indent === true ) { return magicString.getIndentString(); } diff --git a/test/cli/banner-intro-outro-footer/_config.js b/test/cli/banner-intro-outro-footer/_config.js index 2e30a3c..2d67639 100644 --- a/test/cli/banner-intro-outro-footer/_config.js +++ b/test/cli/banner-intro-outro-footer/_config.js @@ -1,4 +1,4 @@ module.exports = { description: 'adds banner/intro/outro/footer', - command: 'rollup -i main.js -f iife --banner "// banner" --intro "// intro" --outro "// outro" --footer "// footer"' + command: 'rollup -i main.js -f iife --indent --banner "// banner" --intro "// intro" --outro "// outro" --footer "// footer"' }; diff --git a/test/cli/module-name/_config.js b/test/cli/module-name/_config.js index da790e4..ca5d167 100644 --- a/test/cli/module-name/_config.js +++ b/test/cli/module-name/_config.js @@ -1,4 +1,4 @@ module.exports = { description: 'generates UMD export with correct moduleName', - command: 'rollup main.js --format umd --name myBundle' + command: 'rollup main.js --format umd --name myBundle --indent' }; diff --git a/test/cli/no-strict/_config.js b/test/cli/no-strict/_config.js index efc646d..72d4a32 100644 --- a/test/cli/no-strict/_config.js +++ b/test/cli/no-strict/_config.js @@ -1,4 +1,4 @@ module.exports = { description: 'use no strict option', - command: 'rollup -i main.js -f iife --no-strict' + command: 'rollup -i main.js -f iife --no-strict --indent' }; diff --git a/test/cli/no-treeshake/_config.js b/test/cli/no-treeshake/_config.js index 18d8b69..be25c45 100644 --- a/test/cli/no-treeshake/_config.js +++ b/test/cli/no-treeshake/_config.js @@ -1,4 +1,4 @@ module.exports = { description: 'generates IIFE export with all code', - command: 'rollup main.js --format iife --name shakeless --no-treeshake' + command: 'rollup main.js --format iife --name shakeless --no-treeshake --indent' }; diff --git a/test/test.js b/test/test.js index e68452b..05f400f 100644 --- a/test/test.js +++ b/test/test.js @@ -274,6 +274,12 @@ describe( 'rollup', function () { const config = loadConfig( FORM + '/' + dir + '/_config.js' ); if ( config.skipIfWindows && process.platform === 'win32' ) return; + if ( !config.options ) { + config.options = {}; + } + if ( !( 'indent' in config.options ) ) { + config.options.indent = true; + } const options = extend( {}, { entry: FORM + '/' + dir + '/main.js',