Skip to content

Commit

Permalink
fixed an issue with using multiple formatters in cucumber
Browse files Browse the repository at this point in the history
  • Loading branch information
beatfactor committed Oct 28, 2021
1 parent db3f04e commit bb55361
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
11 changes: 10 additions & 1 deletion lib/runner/test-runners/cucumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,16 @@ class CucumberSuite extends TestSuite {
const parallelArgs = this.usingCucumberWorkers ? ['--parallel', this.usingCucumberWorkers]: [];
const tagsOption = this.argv.tags ? ['--tags', this.argv.tags] : [];
const extraParams = ['--world-parameters', JSON.stringify(this.argv)];
const formatArg = this.argv.format ? ['--format', this.argv.format] : [];
let formatArg = this.argv.format || [];
if (!Array.isArray(formatArg)) {
formatArg = [formatArg];
}
formatArg = formatArg.reduce((prev, value) => {
prev.push('--format', value);

return prev;
}, []);

const formatOptions = this.argv['format-options'] ? ['--format-options', this.argv['format-options']] : [];

return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('Cucumber integration - parallel running', function() {
Globals.afterEach.call(this, done);
});

it('testCucumberSampleTests in parallel', function() {
it('testCucumberSampleTests in parallel with single formatter', function() {
const source = [
path.join(__dirname, '../../../cucumbertests/testSample.js')
];
Expand All @@ -50,4 +50,27 @@ describe('Cucumber integration - parallel running', function() {
});
});

it('testCucumberSampleTests in parallel with multiple formatters', function() {
const source = [
path.join(__dirname, '../../../cucumbertests/testSample.js')
];

return runTests({
source,
parallel: true,
verbose: false,
timeout: 10,
format: ['progress', 'usage'],
config: path.join(__dirname, '../../../extra/cucumber-config.js'),
'format-options': '',
['retry-interval']: 5,
['persist-globals']: true,
['webdriver-host']: 'localhost',
['start-process']: false,
['webdriver-port']: 10195
}, {})
.then(errorOrFailed => {
assert.strictEqual(errorOrFailed, true);
});
});
});

0 comments on commit bb55361

Please sign in to comment.