Skip to content

Inconsistent beforeEach behavior when 'Run all specs' executed. #3323

@lgandecki

Description

@lgandecki

Current behavior:

As one of cycpress-cucumber-preprocessor plugin users found out:
badeball/cypress-cucumber-preprocessor#139

the beforeEach defined in one file runs for every test.

Having one file:

beforeEach(() => {
  cy.log("This should run only before the first one");
});

describe("abcd", () => {
  it("dfsdfs", () => {});
});

and another:

beforeEach(() => {
  cy.log("This should run only before the second one");
});

describe("abc", () => {
  it("dfsdf", () => {});
});

I would expect them to stick to their unique beforeEaches, and that's how it works when running them separately, and when running them together using cypress run. With cypress open and the "run all specs" function - they both run both beforeEaches.

Desired behavior:

Consistency between runing specs separately and all together.

Steps to reproduce: (app code and test code)

reproduction here: https://github.com/TheBrainFamily/cypress-cucumber-example/tree/beforeEach

Versions

as in the repro - I used macos

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions