Skip to content

Upgrade guide from TheBrainFamily/cypress-cucumber-preprocessor #689

@badeball

Description

@badeball

Transfer of ownership

Due to personal reasons, the previous maintainers of this package are stepping down and handing the reigns over to me, a long-time contributor to the project and a user of it myself. This is a responsibility I'm very excited about. Furthermore, I'd like to thank @lgandecki ++ for all the work that they've done so far.

What's new 🎉

This implementation has been re-written from scratch in TypeScript, has more thorough test coverage and is filled with a bunch of new feature.

  • Support for the Rule keyword.

  • The cypress-tags has been removed and made redundant. Specs containing no matching scenarios are automatically filtered, provided that filterSpecs is set to true.

  • Screenshots are automatically added to JSON reports (including that of failed tests).

  • Other attachments can be added to the report.

  • JSON reports are generated as a single file and manual, post-merging is no longer required.

  • The package is now located under the name @badeball/cypress-cucumber-preprocessor and a deprecation notice will be posted in the old name once NPM transfer is complete.

  • Methods such as Given, When and Then are imported from @badeball/cypress-cucumber-preprocessor, IE. without the ../steps postfix.

  • A large number of issues has implicitly been fixed due to architectural changes.

  • And(..) and But(..) have been deprecated, read more here.

What's missing

  • Bundled features files. This has been deprioritized, due to the associated maintenance cost, awkward implementation and my personal lack of convincing that it's necessary. Using esbuild gives near-instant compilation time of features and removes nearly all performance gain from bundled features anyway.

Changes to configuration

Nearly all configuration options has been removed and there's no distinction between "global" and "non-global" steps anymore. Steps are searched for using patterns and you can chose to include global steps or not.

Below are some configuration examples. Configuration is still implemented using cosmiconfig, meaning that your configuration can reside in multiple locations, such as package.json or .cypress-cucumber-preprocessorrc.json.

Global step definitions exaple

{
  "name": "my project",
  "depdendencies": {},
  "devDepdendencies": {},
  "cypress-cucumber-preprocessor": {
    "stepDefinitions": "cypress/support/step_definitions/**/*.{js,ts}"
  }
}

Step definitions besides scenario

{
  "name": "my project",
  "depdendencies": {},
  "devDepdendencies": {},
  "cypress-cucumber-preprocessor": {
    "stepDefinitions": "cypress/e2e/[filepath].{js,ts}"
  }
}

Step definitions in a directory besides the scenario

{
  "name": "my project",
  "depdendencies": {},
  "devDepdendencies": {},
  "cypress-cucumber-preprocessor": {
    "stepDefinitions": "cypress/e2e/[filepath]/**/*.{js,ts}"
  }
}

Combination of all of the above (default)

{
  "name": "my project",
  "depdendencies": {},
  "devDepdendencies": {},
  "cypress-cucumber-preprocessor": {
    "stepDefinitions": [
      "cypress/e2e/[filepath]/**/*.{js,ts}",
      "cypress/e2e/[filepath].{js,ts}",
      "cypress/support/step_definitions/**/*.{js,ts}"
    ]
  }
}

Still have an issue?

Because this is a re-implementation and thorough test coverage was originally lacking, old issues may resurface and new issue arise. If you have an issue or just a question, please post it below and I'll try to help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions