Skip to content

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

@dahosek

Description

@dahosek

👓 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions