Skip to content

Commit bfce8b2

Browse files
authored
Replace 2 instances of regex with cucumber expression (#1873)
* Replace 2 instance of regex with cucumber expression * Fixing linting issues * Optimizing const string * Making Prettier: from " to '
1 parent 385c262 commit bfce8b2

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

features/step_definitions/cli_steps.ts

+14-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ When(
3030
)
3131

3232
When(
33-
/^I run cucumber-js with arguments `(|.+)` and env `(|.+)`$/,
33+
'I run cucumber-js with arguments `{}` and env `{}`',
3434
{ timeout: 10000 },
3535
async function (this: World, args: string, envString: string) {
3636
const renderedArgs = Mustache.render(valueOrDefault(args, ''), this)
@@ -41,7 +41,7 @@ When(
4141
)
4242

4343
When(
44-
/^I run cucumber-js with env `(|.+)`$/,
44+
'I run cucumber-js with env `{}`',
4545
{ timeout: 10000 },
4646
async function (this: World, envString: string) {
4747
const env = this.parseEnvString(envString)
@@ -50,7 +50,18 @@ When(
5050
)
5151

5252
When(
53-
/^I run cucumber-js with all formatters(?: and `(|.+)`)?$/,
53+
'I run cucumber-js with all formatters',
54+
{ timeout: 10000 },
55+
async function (this: World) {
56+
const args = '--format html:html.out --format json:json.out'
57+
const renderedArgs = Mustache.render(args, this)
58+
const stringArgs = stringArgv(renderedArgs)
59+
return await this.run(this.localExecutablePath, stringArgs)
60+
}
61+
)
62+
63+
When(
64+
'I run cucumber-js with all formatters and `{}`',
5465
{ timeout: 10000 },
5566
async function (this: World, args: string) {
5667
if (doesNotHaveValue(args)) {

0 commit comments

Comments
 (0)