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

Nested .only is ignored #3818

Closed
Floriferous opened this issue Mar 25, 2019 · 3 comments
Closed

Nested .only is ignored #3818

Floriferous opened this issue Mar 25, 2019 · 3 comments

Comments

@Floriferous
Copy link

Floriferous commented Mar 25, 2019

Current behavior:

When a describe with a .only contains an it with a .only as well, it ignores the second one and runs the full test suite.

Desired behavior:

The nested it should be the only test that is run.

Steps to reproduce: (app code and test code)

// Both tests are being run
describe.only('suite', () => {
  it('should not run this test');

  it.only('should only run this test');
})

Versions

Cypress 3.1.5

@flotwig
Copy link
Contributor

flotwig commented Mar 25, 2019

The second .only will be superseded by the first .only. Cypress is based on Mocha 2.x, and before Mocha 3, only one .only can be used at a time:

Previous to v3.0.0, .only() used string matching to decide which tests to execute; this is no longer the case. In v3.0.0 or newer, .only() can be used multiple times to define a subset of tests to run
https://mochajs.org/#exclusive-tests

If you want to run only that one test case, use the it.only. If you only want to run that describe, use the describe.only.

@Floriferous
Copy link
Author

Floriferous commented Mar 25, 2019 via email

@flotwig
Copy link
Contributor

flotwig commented Mar 25, 2019

@Floriferous It would be a potentially breaking change for existing users. Cypress will upgrade to Mocha v5.2.0 as part of the next major release, v4.0 v5.0: #2703

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

No branches or pull requests

2 participants