diff --git a/lib/runner/test-runners/cucumber.js b/lib/runner/test-runners/cucumber.js index 3295a29e1c..8755f957e3 100644 --- a/lib/runner/test-runners/cucumber.js +++ b/lib/runner/test-runners/cucumber.js @@ -92,9 +92,7 @@ class CucumberSuite extends TestSuite { } shouldUseNightwatchFormatter(options) { - return ((!options.format && - !this.argv.format && - NightwatchEventHub.isAvailable) || + return (NightwatchEventHub.isAvailable || options.format === 'nightwatch-format' || this.argv.format === 'nightwatch-format' ); @@ -113,7 +111,7 @@ class CucumberSuite extends TestSuite { } if (this.shouldUseNightwatchFormatter(options)) { - options.format = path.join(__dirname, '../../../cucumber-js/nightwatch-format.js'); + options.format = [...(options.format || []), path.join(__dirname, '../../../cucumber-js/nightwatch-format.js')]; } const {feature_path = ''} = options; @@ -158,7 +156,11 @@ class CucumberSuite extends TestSuite { const allArgv = { ...options, - ...this.argv + ...this.argv, + format: [ + ...(Array.isArray(options.format) ? options.format : (isString(options.format) ? [options.format] : [])), + ...(Array.isArray(this.argv.format) ? this.argv.format : (isString(this.argv.format) ? [this.argv.format] : [])) + ] }; if ((isDefined(allArgv[argName]) && allArgv[argName] !== '') ||