Skip to content

Commit

Permalink
more refactoring for cucumber implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
beatfactor committed Jan 12, 2022
1 parent b05cb52 commit a8c9277
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/runner/test-runners/cucumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class CucumberSuite extends TestSuite {
if (options.feature_path && !Array.isArray(options.feature_path)) {
options.feature_path = [options.feature_path];
}
const {feature_path} = options;
const {feature_path = ''} = options;
const parallelArgs = this.usingCucumberWorkers ? ['--parallel', this.usingCucumberWorkers]: [];
const additionalOptions = this.buildArgvValue(['tags', 'retry-tag-filter', 'profile', 'format', 'format-options', 'dry-run', 'fail-fast', ['retries', 'retry'], 'no-strict', 'name']);
const extraParams = ['--world-parameters', JSON.stringify(this.argv)];
Expand Down Expand Up @@ -138,7 +138,14 @@ class CucumberSuite extends TestSuite {
argValues = [argValues];
}

argValues.forEach(value => prev.push(`--${key}`, value));
argValues.forEach(value => {
const args = [`--${key}`];
if (value !== true) {
args.push(value);
}

prev.push(...args);
});
}

return prev;
Expand Down
1 change: 1 addition & 0 deletions test/src/runner/cucumber-integration/testCliArgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe('Cucumber cli arguments', function(){
modulePath: [path.join(__dirname, '../../../cucumbertests/testSample.js')]
});

assert.strictEqual(cliArgs.length, 21);
assert.ok(cliArgs.includes('--name'));
assert.strictEqual(cliArgs[cliArgs.indexOf('--name')+1], 'sample');
assert.ok(cliArgs.includes('--fail-fast'));
Expand Down

0 comments on commit a8c9277

Please sign in to comment.