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

Adding .only to multiple tests only runs the last one #2828

Closed
nachocab opened this issue Nov 23, 2018 · 4 comments
Closed

Adding .only to multiple tests only runs the last one #2828

nachocab opened this issue Nov 23, 2018 · 4 comments

Comments

@nachocab
Copy link

nachocab commented Nov 23, 2018

Current behavior:

When I run this suite

describe('do something', function() {
  it.only('1 does this', function (){...}) // doesn't run
  it('2 does that later', function (){...}) // doesn't run
  it.only('3 does this as well', function (){...}) // runs
})

I would expect only tests 1 and 3 to run (this is what happens in mocha), but Cypress only runs the last one (3). Surprisingly, it does allow running more than one test when using only if they have the same name.

describe('do something', function() {
  it.only('1 does this', function (){...}) // runs
  it('2 does that later', function (){...}) // doesn't run
  it.only('1 does this', function (){...}) // runs
})

It would be nice if only in Cypress matched the behavior of mocha

@jennifer-shehane
Copy link
Member

This is related to Cypress using an earlier version of Mocha. Much of the work for the upgrade has been done though and is awaiting release. #2528

@jennifer-shehane
Copy link
Member

The code for this is done in 4.0, but this has yet to be released. We'll update this issue and reference the changelog when it's released.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Feb 6, 2020

Released in 4.0.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.0.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Feb 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@nachocab @jennifer-shehane and others