cypress-grep
Advanced tools
Comparing version 2.9.3 to 2.10.0
{ | ||
"name": "cypress-grep", | ||
"version": "2.9.3", | ||
"version": "2.10.0", | ||
"description": "Filter tests using substring", | ||
@@ -5,0 +5,0 @@ "main": "src/support", |
@@ -220,2 +220,32 @@ # cypress-grep | ||
### omit filtered tests | ||
By default, all filtered tests are made _pending_ using `it.skip` method. If you want to completely omit them, pass the environment variable `grepOmitFiltered=true`. | ||
Pending filtered tests | ||
``` | ||
cypress run --env grep="works 2" | ||
``` | ||
 | ||
Omit filtered tests | ||
``` | ||
cypress run --env grep="works 2",grepOmitFiltered=true | ||
``` | ||
 | ||
**Tip:** you can set this environment variable in the `cypress.json` file to enable it by default and skip using the environment variable: | ||
```json | ||
{ | ||
"env": { | ||
"grepOmitFiltered": true | ||
} | ||
} | ||
``` | ||
### grep untagged tests | ||
@@ -222,0 +252,0 @@ |
@@ -38,2 +38,8 @@ const debug = require('debug')('cypress-grep') | ||
const omitFiltered = | ||
config.env.grepOmitFiltered || config.env['grep-omit-filtered'] | ||
if (omitFiltered) { | ||
console.log('cypress-grep: will omit filtered tests') | ||
} | ||
const grepFilterSpecs = config.env.grepFilterSpecs === true | ||
@@ -40,0 +46,0 @@ if (grepFilterSpecs) { |
@@ -45,3 +45,7 @@ // @ts-check | ||
debug('grep %o', { grep, grepTags, grepBurn }) | ||
/** @type {boolean} Omit filtered tests completely */ | ||
const omitFiltered = | ||
Cypress.env('grepOmitFiltered') || Cypress.env('grep-omit-filtered') | ||
debug('grep %o', { grep, grepTags, grepBurn, omitFiltered }) | ||
if (!Cypress._.isInteger(grepBurn) || grepBurn < 1) { | ||
@@ -116,4 +120,9 @@ throw new Error(`Invalid grep burn value: ${grepBurn}`) | ||
// skip tests without grep string in their names | ||
return _it.skip(name, options, callback) | ||
if (omitFiltered) { | ||
// omit the filtered tests completely | ||
return | ||
} else { | ||
// skip tests without grep string in their names | ||
return _it.skip(name, options, callback) | ||
} | ||
} | ||
@@ -120,0 +129,0 @@ |
32004
465
492