cypress-io / cypress-grep

Filter tests using substring
137 stars 19 forks source link

cypress-grep does not work (cypress, jest) #81

Closed zako05 closed 2 years ago

zako05 commented 2 years ago

Hi there,

cypress-grep still does not work for me. It seems that "grep" part is ignored. I'd like to ask you whether your solution is built up on macha "-- grep" pattern, and whether Jest might be the problem that 'grep' is ignored.

Here is what I'm trying to do:

command:

npx cypress run --env grepTags="@shallow" --spec cypress/specs/ui/<spec-name>

spec example:

describe('some description', () => {
  it('test name', {tags: '@shallow'}, () => {})
  it('test name 2' () => {})
  it('test name 3' () => {})
  it('test name 4' () => {})
})

It always runs all tests. My expectation would be that it will run only the first test "test name".

Thanks a lot for any helps.

bahmutov commented 2 years ago

So it runs all specs, skipping all tests in each except in the spec you are showing, and in that spec it only runs (correctly) the test "test name" with the tag "@shallow"? And the problem / question is why it even runs the other specs?

zako05 commented 2 years ago

in that spec it only runs (correctly) the test "test name" with the tag "@shallow"?

So, the question is why it even runs the other tests without the tag.

bahmutov commented 2 years ago

Ok, so now that I understand your question, here is the answer: https://github.com/cypress-io/cypress-grep#grepfilterspecs