Skip to content

Latest commit

 

History

History
47 lines (36 loc) · 1.44 KB

File metadata and controls

47 lines (36 loc) · 1.44 KB

Setup with cypress-cucumber-preprocessor

⚠️ @badeball/cypress-cucumber-preprocessor require node >= 18

  1. Follow the steps in the main README to setup the reporter.

  2. Your cypress.config.js file should look like:

    const { defineConfig } = require('cypress');
    const cypressOnFix = require('cypress-on-fix');
    const createBundler = require('@bahmutov/cypress-esbuild-preprocessor');
    const { addCucumberPreprocessorPlugin } = require('@badeball/cypress-cucumber-preprocessor');
    const { createEsbuildPlugin } = require('@badeball/cypress-cucumber-preprocessor/esbuild');
    
    module.exports = defineConfig({
      reporter: 'cypress-mochawesome-reporter',
      video: true,
      retries: 1,
      e2e: {
        specPattern: 'cypress/e2e/**/*.feature',
        async setupNodeEvents(on, config) {
          // "cypress-on-fix" is required because "cypress-mochawesome-reporter" and "cypress-cucumber-preprocessor" use the same hooks
          on = cypressOnFix(on);
    
          require('cypress-mochawesome-reporter/plugin')(on);
    
          await addCucumberPreprocessorPlugin(on, config);
    
          on(
            'file:preprocessor',
            createBundler({
              plugins: [createEsbuildPlugin(config)],
            })
          );
    
          return config;
        },
      },
    });
  3. Add to cypress/support/step_definitions/index.js

    import 'cypress-mochawesome-reporter/cucumberSupport';