cucumber-js icon indicating copy to clipboard operation
cucumber-js copied to clipboard

A feature which ends with (s) will not be matchable in the step definitions.

Open dahosek opened this issue 9 months ago โ€ข 0 comments

๐Ÿ‘“ What did you see?

Given a line like the following in a feature file:ยน

And pagination parameter: first 1 response(s)

The following suggestion is given:

  ? And pagination parameter: first 1 response(s)
       Undefined. Implement with the following snippet:
       
         @given('pagination parameter: first {int} response\(s)')
         paginationParameterFirstintResponses(int: number): any {
           //Write code here that turns the phrase above into concrete actions
           return 'pending';
         }

but the specified code will not match. It seems that any expression (regardless of location and contents) which has \(โ€ฆ) will fail.


  1. Iโ€™m aware that (s) should be used in the cucumber expression and not in the feature file, this was a specification given by an internal third party that I had hoped to avoid.

โœ… What did you expect to see?

Proper handling of literal parentheses in the input on a feature file.

๐Ÿ“ฆ Which tool/library version are you using?

    "@cucumber/cucumber": "^11.2.0",
    "@lynxwall/cucumber-tsflow": "^6.5.7",

node: v22.13.0

๐Ÿ”ฌ How could we reproduce it?

With the following feature file:

Feature: Test
  Scenario: Demonstrating a bug
    Given pagination parameter: first 1 response(this) in it

and a step definition in typescript as:

@binding()
export class MySteps {
  @given('pagination parameter: first {int} response\(this) in it')
  public paginationFirst(count: number) {

  }
}

Run with npx cucumber-tsflow

๐Ÿ“š Any additional context?

(While the error is generated by tsflow, I believe the underlying issue is in cucumber-js, and an equivalent step definition in pure JS should still work).

dahosek avatar Feb 20 '25 22:02 dahosek