Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

describe.only() does not work when string is the same as another describe() block #5345

Closed
c32hedge opened this issue Oct 10, 2019 · 5 comments · May be fixed by rangle/test-automation#29
Closed

Comments

@c32hedge
Copy link

c32hedge commented Oct 10, 2019

Current behavior:

If you have multiple describe blocks with the same description string, marking one of them with describe.only will run all describe blocks with the same description instead of just the one with .only:

image

Desired behavior:

Marking a describe block with .only should "only" run that describe block, not others with the same description.

Steps to reproduce: (app code and test code)

Run the following spec:

describe('outer describe', () => {
  describe('inner describe', () => {
    it('works', () => {});
  });

  describe.only('inner describe', () => {
    it('works again', () => {});
  });

  describe('unique name', () => {
    it('still works', () => {});
  });

  describe('inner describe', () => {
    it('works yet again', () => {});
  });
});

Instead of just running one test with the description "works again", three tests are executed, in all three describe('inner describe'...) blocks.

Versions

Cypress 3.4.1
Ubuntu 18.04
Chrome 77

@c32hedge
Copy link
Author

It's worth noting that Mocha itself used to have this issue (see mochajs/mocha#1834, fixed by mochajs/mocha#1807).

@jennifer-shehane
Copy link
Member

Cypress uses a Mocha version 2.5.3, this is fixed in later versions. Going to close this as a duplicate of #2528 - which will be released in Cypress 4.0.0 release.

@jennifer-shehane jennifer-shehane added the type: duplicate This issue or pull request already exists label Oct 10, 2019
@c32hedge
Copy link
Author

Wow, so Cypress is still on a version that's over three years old 😱

@cypress-io cypress-io locked and limited conversation to collaborators Jan 3, 2020
@jennifer-shehane jennifer-shehane added stage: pending release and removed type: duplicate This issue or pull request already exists labels Jan 29, 2020
@jennifer-shehane
Copy link
Member

I've confirmed that this will be fixed in upcoming 4.0 release.

Screen Shot 2020-01-29 at 3 44 22 PM

@flotwig
Copy link
Contributor

flotwig commented Feb 6, 2020

Released in 4.0.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants