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

Multiple test blocks are running despite .only #632

Closed
bahmutov opened this issue Sep 11, 2017 · 7 comments
Closed

Multiple test blocks are running despite .only #632

bahmutov opened this issue Sep 11, 2017 · 7 comments
Labels
type: bug type: unexpected behavior User expected result, but got another

Comments

@bahmutov
Copy link
Contributor

bahmutov commented Sep 11, 2017

Issue in bahmutov/effective-e2e-testing-with-cypress#1 code in https://github.com/bahmutov/effective-e2e-testing-with-cypress/tree/double-only

I think this is because one block has title that is substring of another block

Current behavior:

describe.only('main features', function () {
  it('first spec', function () {})
})

describe('main features with assertions', function () {
  it('second spec', function () {})
})

Runs both blocks despite .only

screen shot 2017-09-11 at 4 38 33 pm

Desired behavior:

Run only the block with describe.only

How to reproduce:

Clone repo, grab branch double-only, open Cypress

Additional Info (images, stack traces, etc)

  • Operating System: Mac
  • Cypress Version: 0.20.0
  • Browser Version: Electron
@bahmutov bahmutov added type: bug type: unexpected behavior User expected result, but got another labels Sep 11, 2017
@zukoaang
Copy link

I have the same issue.
Did you ever solve this?
Hasn't anyone responded here?

@brian-mann
Copy link
Member

This is mocha's default behavior in the version we are using. It is to be expected.

@zukoaang
Copy link

zukoaang commented Jul 2, 2018

@brian-mann
So do you mean that in the Mocha's version you're using, the .only just isn't supported?
That was not expected at all.
Is that intentional?
Will it be changed?

@kuceb
Copy link
Contributor

kuceb commented Jul 5, 2018

@zukoaang it seems to be a bug in mocha mochajs/mocha#1481

@brian-mann
Copy link
Member

brian-mann commented Jul 5, 2018

@zukoaang We are on an older version of mocha that will match suites and tests by a regexp. When you put an .only on one of them - if other suites and tests match that title they will run as well.

In later versions they fixed this. We'd need to upgrade to get access to that functionality. We have deep, deep integrations into mocha so upgrading for us isn't a simple npm install.

The good news is that we've recently talked about doing this so this would "just work" when we do the next upgrade.

In the mean time, simply make your titles different enough and you won't see multiple tests and suites run when using an .only

@jennifer-shehane jennifer-shehane added the stage: ready for work The issue is reproducible and in scope label Aug 1, 2018
@jennifer-shehane jennifer-shehane added stage: pending release and removed stage: ready for work The issue is reproducible and in scope labels Jul 12, 2019
@jennifer-shehane
Copy link
Member

I've verified that this will be fixed from #2703 - our Mocha update PR.

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

@jennifer-shehane
Copy link
Member

Released in 4.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug type: unexpected behavior User expected result, but got another
Projects
None yet
Development

No branches or pull requests

5 participants