From feb72bca06c2d7d8f185d9fea466f662eceea7ba Mon Sep 17 00:00:00 2001 From: egavr Date: Thu, 22 Dec 2016 16:59:03 +0300 Subject: [PATCH] fix: set default reporter for command 'update' --- lib/cli/index.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/cli/index.js b/lib/cli/index.js index c75651a27..16964db12 100644 --- a/lib/cli/index.js +++ b/lib/cli/index.js @@ -97,17 +97,9 @@ function runGemini(method, paths, options) { return gemini; }) .then((gemini) => { - function parseReporterOptions(options) { - return options.reporter.map(function(name) { - return { - name, - path: options[`${name}ReporterPath`] - }; - }); - } return gemini[method](paths, { sets: options.set, - reporters: parseReporterOptions(options) || [{name: 'flat'}], + reporters: parseReporterOptions(options), grep: program.grep, browsers: program.browser, diff: options.diff, @@ -124,6 +116,19 @@ function runGemini(method, paths, options) { .then(exit); } +function parseReporterOptions(options) { + if (!options.reporter) { + return [{name: 'flat'}]; + } + + return options.reporter.map(function(name) { + return { + name, + path: options[`${name}ReporterPath`] + }; + }); +} + function exit(code) { process.on('exit', () => process.exit(exitCode || code)); }