Skip to content

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

@nachocab

Description

@nachocab

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions