Skip to content
This repository was archived by the owner on Mar 29, 2023. It is now read-only.

Commit 93aee5c

Browse files
committed
docs: update readme with latest changes
1 parent 0e51f33 commit 93aee5c

File tree

1 file changed

+50
-23
lines changed

1 file changed

+50
-23
lines changed

README.md

Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ Table of Contents
2828
<!-- MarkdownTOC autolink="true" -->
2929

3030
- [Install](#install)
31-
- [Plugin file](#plugin-file)
31+
- [Support file](#support-file)
32+
- [Config file](#config-file)
3233
- [Usage Overview](#usage-overview)
3334
- [Filter by test title](#filter-by-test-title)
3435
- [OR substring matching](#or-substring-matching)
@@ -38,8 +39,9 @@ Table of Contents
3839
- [Tags in the test config object](#tags-in-the-test-config-object)
3940
- [AND tags](#and-tags)
4041
- [OR tags](#or-tags)
41-
- [Test suites](#test-suites-1)
42-
- [Invert tag](#invert-tag)
42+
- [Inverted tags](#inverted-tags)
43+
- [NOT tags](#not-tags)
44+
- [Tags in test suites](#tags-in-test-suites)
4345
- [Grep untagged tests](#grep-untagged-tests)
4446
- [Pre-filter specs \(grepFilterSpecs\)](#pre-filter-specs-grepfilterspecs)
4547
- [Omit filtered tests \(grepOmitFiltered\)](#omit-filtered-tests-grepomitfiltered)
@@ -56,6 +58,7 @@ Table of Contents
5658
- [See also](#see-also)
5759
- [Migration guide](#migration-guide)
5860
- [from v1 to v2](#from-v1-to-v2)
61+
- [from v2 to v3](#from-v2-to-v3)
5962
- [Videos & Blog Posts](#videos--blog-posts)
6063
- [Blog posts](#blog-posts)
6164
- [Small print](#small-print)
@@ -65,7 +68,7 @@ Table of Contents
6568

6669
## Install
6770

68-
Assuming you have Cypress installed, add this module as a dev dependency
71+
Assuming you have Cypress installed, add this module as a dev dependency.
6972

7073
```shell
7174
# using NPM
@@ -74,7 +77,10 @@ npm i -D cypress-grep
7477
yarn add -D cypress-grep
7578
```
7679

80+
**Note**: cypress-grep only works with Cypress version >= 10.
81+
7782
### Support file
83+
7884
**required:** load this module from the [support file](https://on.cypress.io/writing-and-organizing-tests#Support-file) or at the top of the spec file if not using the support file. You improve the registration function and then call it:
7985

8086
```js
@@ -89,7 +95,6 @@ import registerCypressGrep from 'cypress-grep'
8995
registerCypressGrep()
9096
```
9197

92-
9398
### Config file
9499

95100
**optional:** load and register this module from the [config file](https://docs.cypress.io/guides/references/configuration#setupNodeEvents):
@@ -259,41 +264,59 @@ You can run tests that match one tag or another using spaces. Make sure to quote
259264
--env grepTags='@slow @critical'
260265
```
261266

262-
### Test suites
267+
### Inverted tags
263268

264-
The tags are also applied to the "describe" blocks. In that case, the tests look up if any of their outer suites are enabled.
269+
You can skip running the tests with specific tag using the invert option: prefix the tag with the character `-`.
265270

266-
```js
267-
describe('block with config tag', { tags: '@smoke' }, () => {})
268271
```
272+
# do not run any tests with tag "@slow"
273+
--env grepTags=-@slow
274+
```
275+
276+
If you want to run all tests with tag `@slow` but without tag `@smoke`:
269277

270278
```
271-
# run any tests in the blocks having "@smoke" tag
272-
--env grepTags=@smoke
273-
# skip any blocks with "@smoke" tag
274-
--env grepTags=-@smoke
279+
--env grepTags=@slow+-@smoke
275280
```
276281

277-
See the [cypress/integration/describe-tags-spec.js](./cypress/integration/describe-tags-spec.js) file.
282+
**Note:** Inverted tag filter is not compativle with the `grepFilterSpecs` option
278283

279-
**Note:** global function `describe` and `context` are aliases and both supported by this plugin.
284+
### NOT tags
280285

281-
### Invert tag
286+
You can skip running the tests with specific tag, even if they have a tag that should run, using the not option: prefix the tag with `--`.
282287

283-
You can skip running the tests with specific tag using the invert option: prefix the tag with the character `-`.
288+
Note this is the same as appending `+-<tag to never run>` to each tag. May be useful with large number of tags.
289+
290+
If you want to run tests with tags `@slow` or `@regression` but without tag `@smoke`
284291

285292
```
286-
# do not run any tests with tag "@slow"
287-
--env grepTags=-@slow
293+
--env grepTags='@slow @regression --@smoke'
288294
```
289295

290-
If you want to run all tests with tag `@slow` but without tag `@smoke`:
296+
which is equivalent to
291297

292298
```
293-
--env grepTags=@slow+-@smoke
299+
--env grepTags='@slow+-@smoke @regression+-@smoke'
294300
```
295301

296-
**Note:** Inverted tag filter is not compativle with the `grepFilterSpecs` option
302+
### Tags in test suites
303+
304+
The tags are also applied to the "describe" blocks. In that case, the tests look up if any of their outer suites are enabled.
305+
306+
```js
307+
describe('block with config tag', { tags: '@smoke' }, () => {})
308+
```
309+
310+
```
311+
# run any tests in the blocks having "@smoke" tag
312+
--env grepTags=@smoke
313+
# skip any blocks with "@smoke" tag
314+
--env grepTags=-@smoke
315+
```
316+
317+
See the [cypress/integration/describe-tags-spec.js](./cypress/integration/describe-tags-spec.js) file.
318+
319+
**Note:** global function `describe` and `context` are aliases and both supported by this plugin.
297320

298321
### Grep untagged tests
299322

@@ -363,7 +386,7 @@ cypress run --env grep="works 2",grepOmitFiltered=true
363386

364387
## Disable grep
365388

366-
If you specify the `grep` parameters inside `cypress.json` file, you can disable it from the command line
389+
If you specify the `grep` parameters the [config file](https://docs.cypress.io/guides/references/configuration), you can disable it from the command line
367390

368391
```
369392
$ npx cypress run --env grep=,grepTags=,burn=
@@ -562,6 +585,10 @@ The above scenario was confusing - did you want to find all tests with title con
562585
--env grep=hello,grepTags=smoke
563586
```
564587

588+
### from v2 to v3
589+
590+
Version >= 3 of cypress-grep _only_ supports Cypress >= 10.
591+
565592
## Videos & Blog Posts
566593

567594
Watch the video [intro to cypress-grep](https://www.youtube.com/watch?v=HS-Px-Sghd8) which shows how this repository tags tests, uses [cypress-grep](https://github.com/cypress-io/cypress-grep) plugin, and sets up the TypeScript intelligent code completion.

0 commit comments

Comments
 (0)