cypress-io / cypress-grep

Filter tests using substring
137 stars 19 forks source link

Separate test title string from the tags #25

Closed bahmutov closed 3 years ago

bahmutov commented 3 years ago

It is confusing to use the same parameter --grep= to both search the test title and tags. I think a much cleaner use case would be:

Imagine the tests like this:

it('helps', () => {...})

it('works', { tags: 'smoke' }, () => {...})

it('works more', { tags: ['smoke', 'slow'] }, () => {...})

Then we could filter tests like:

# run just the first test
$ npx cypress --env grep=hello
# run all tests without hello in their title
$ npx cypress --env grep=-hello
# run the test with title "works more"
$ npx cypress --env grep="works more"

# run all tests with tag "smoke"
$ npx cypress --env grep-tags=smoke
# run all tests with tag "smoke" or "slow"
$ npx cypress --env grep-tags="smoke slow"
# run all tests with tag "smoke" AND "slow"
$ npx cypress --env grep-tags=smoke+slow
$ npx cypress --env grep-tags="smoke +slow"
# run all tests with tag "smoke" but without tag "slow"
$ npx cypress --env grep-tags=smoke-slow
$ npx cypress --env grep-tags="smoke -slow"
bahmutov commented 3 years ago

This would be a breaking change

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 2.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: