diff --git a/config.tpl.coffee b/config.tpl.coffee index c49a74d12..05c39992c 100644 --- a/config.tpl.coffee +++ b/config.tpl.coffee @@ -14,14 +14,12 @@ module.exports = (config) -> # list of files / patterns to load in the browser - files: [ - %FILES% + files: [%FILES% ] # list of files to exclude - exclude: [ - %EXCLUDE% + exclude: [%EXCLUDE% ] diff --git a/config.tpl.js b/config.tpl.js index de52f1aaa..51bb6564c 100644 --- a/config.tpl.js +++ b/config.tpl.js @@ -14,14 +14,12 @@ module.exports = function(config) { // list of files / patterns to load in the browser - files: [ - %FILES% + files: [%FILES% ], // list of files to exclude - exclude: [ - %EXCLUDE% + exclude: [%EXCLUDE% ], diff --git a/config.tpl.ls b/config.tpl.ls index 9ea73648e..b15e7842c 100644 --- a/config.tpl.ls +++ b/config.tpl.ls @@ -14,14 +14,12 @@ module.exports = (config) -> # list of files / patterns to load in the browser - files: [ - %FILES% + files: [%FILES% ] # list of files to exclude - exclude: [ - %EXCLUDE% + exclude: [%EXCLUDE% ] diff --git a/lib/init/formatters.js b/lib/init/formatters.js index 6511c11e9..124ffd375 100644 --- a/lib/init/formatters.js +++ b/lib/init/formatters.js @@ -29,7 +29,7 @@ var JavaScriptFormatter = function() { }; var pad = function(str, pad) { - return str.replace(/\n/g, '\n' + pad); + return str.replace(/\n/g, '\n' + pad).replace(/\s+$/gm, ''); }; var formatQuottedList = function(list) { @@ -46,7 +46,11 @@ var JavaScriptFormatter = function() { files.push(quoteNonIncludedPattern(onlyServedFile)); }); - return files.join(',\n '); + files = files.map(function(file) { + return '\n ' + file; + }); + + return files.join(','); }; this.formatPreprocessors = function(preprocessors) { diff --git a/test/unit/init/formatters.spec.coffee b/test/unit/init/formatters.spec.coffee index a1b3d8f12..034f36403 100644 --- a/test/unit/init/formatters.spec.coffee +++ b/test/unit/init/formatters.spec.coffee @@ -30,7 +30,7 @@ describe 'init/formatters', -> expect(replacements.FILES).to.equal '' replacements = formatter.formatAnswers createAnswers {files: ['*.js', 'other/file.js']} - expect(replacements.FILES).to.equal "'*.js',\n 'other/file.js'" + expect(replacements.FILES).to.equal "\n '*.js',\n 'other/file.js'" it 'should format BROWSERS', -> @@ -52,7 +52,7 @@ describe 'init/formatters', -> onlyServedFiles: ['src/*.js'] } - expect(replacements.FILES).to.equal "'test-main.js',\n" + + expect(replacements.FILES).to.equal "\n 'test-main.js',\n" + " {pattern: 'src/*.js', included: false}"