Skip to content

An error was thrown in your plugins file while executing the handler for the before:spec event #1142

@DianaPlesa92

Description

@DianaPlesa92

Current behavior

When running tests with cypress + badeball/cypress-cucumber-preprocessor integrated, and run command, I get this error:

An error was thrown in your plugins file while executing the handler for the before:spec event.
The error we received was:
Error: Unexpected state in beforeSpecHandler: received-envelopes (this might be a bug, please report at https://github.com/badeball/cypress-cucumber-preprocessor)
at createError (C:\InvoiceAutomation\AutoTest\node_modules@badeball\cypress-cucumber-preprocessor\dist\helpers\error.js:9:12)
at beforeSpecHandler (C:\InvoiceAutomation\AutoTest\node_modules@badeball\cypress-cucumber-preprocessor\dist\plugin-event-handlers.js:190:43)
at processTicksAndRejections (node:internal/process/task_queues:95:5)

Command:
node_modules.bin\cypress run -spec 'cypress/e2e/duckduckgo.feature' --headless --env fileConfig=stage

I have tried cypress-on-fix and it does not help.
I am using before and beforeEach in my test cases in which I am visiting the url.

Visiting the url outside before/beforeEach hooks works fine with run command.
Using cypress open works fine.
image

Desired behavior

No errors when running tests configured with before and beforeEach hooks with cypress run.

Test code to reproduce

Repository link: https://github.com/DianaPlesa92/AutoTest/tree/main

Versions

  • Cypress version:13.6.2
  • Preprocessor version:20.0.0
  • Node version:v18.13.0

Checklist

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