cypress-cucumber-preprocessor: optional text in cucumber expression does not match

Current behavior

Omitted optional text in cucumber expressions do not match.

Expected behavior

Omitted optional text in cucumber expressions should match.

Test code to reproduce

I assume 'this is a cucumber epression' as indicated in the preprocessor docs and defined in the cucumber docs.

Then('I am on the start page (again)', () => {}); does not match Then I am on the start page

Step implementation missing for “I am on the start page”.

(However, it does match Then I am on the start page again.)

Versions

  • Cypress: 10.3.1
  • Preprocessor: 12.0.0
  • Node: 14.17.0

Checklist

  • I’ve read the FAQ.
  • I’ve read Instructions for logging issues.
  • I’m not using cypress-cucumber-preprocessor@4.3.1 (package name has changed and it is no longer the most recent version, see #689).

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

No, I don’t think so. It’s not possible to infer the types of the args of a step-def-body statically. I might have replaced any with unknown and require each dev to explicitly state each expected type, although it’s not going to give you any runtime guarantees.

Sure, like this

Given(transform("I am on the start page (again)"), function () {
  ...
});

You can find multiple cucumber libs listed as dependencies in package.json, including @cucumber/cucumber-expressions.