Search code examples
cypresscypress-cucumber-preprocessor

Error: Step implementation missing for: [step_definition] when trying to run a scenario using cucumber with cypress 10


I have updated my project to cypress 10. But getting this error couldn't solve the problem described in the title.

my feature file: enter image description here

spec file: enter image description here

Error: enter image description here

File order: enter image description here

Config file: enter image description here

package.json file: enter image description here


Solution

  • It's probably a mistake to use both cypress-cucumber-preprocessor and @badeball/cypress-cucumber-preprocessor in the same project.

    Uninstall cypress-cucumber-preprocessor, it is a defunct version.

    Then follow badeball Example setup to make corrections to the configuration, for example

    import { defineConfig } from "cypress";
    import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
    import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
    import createEsbuildPlugin from "@badeball/cypress-cucumber-preprocessor/esbuild";
    
    export default defineConfig({
      e2e: {
        specPattern: "**/*.feature",
        async setupNodeEvents(
          on: Cypress.PluginEvents,
          config: Cypress.PluginConfigOptions
        ): Promise<Cypress.PluginConfigOptions> {
          // This is required for the preprocessor to be able to generate JSON reports after each run, and more,
          await addCucumberPreprocessorPlugin(on, config);
    
          on(
            "file:preprocessor",
            createBundler({
              plugins: [createEsbuildPlugin(config)],
            })
          );
    
          // Make sure to return the config object as it might have been modified by the plugin.
          return config;
        },
      },
    });