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

Commit c6f15c9

Browse files
joshuajtwardAdam Murray
authored andcommitted
use specPattern to detect Cypress version
1 parent 0a5c1c3 commit c6f15c9

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ To use this module with [Cypress v10.0.0](https://docs.cypress.io/guides/referen
7979

8080
```js
8181
{
82-
env: { grepNewConfig: true },
8382
e2e: {
8483
setupNodeEvents(on, config) {
8584
require('cypress-grep/src/plugin')(config);

src/plugin.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ function cypressGrepPlugin(config) {
1717

1818
const { env } = config
1919

20+
// detecting which version is running using specPattern - specPattern is only present from v10.0.0+
21+
const isAtLeastV10 = config.e2e.specPattern || config.component.specPattern
22+
2023
debug(
2124
'Config type: %s',
22-
env.grepNewConfig
25+
isAtLeastV10
2326
? 'new (Cypress version >= v10.0.0)'
2427
: 'legacy (Cypress version < v10.0.0)',
2528
)
@@ -117,7 +120,7 @@ function cypressGrepPlugin(config) {
117120
debug('%o', greppedSpecs)
118121
}
119122
if (greppedSpecs.length) {
120-
env.grepNewConfig
123+
isAtLeastV10
121124
? (config.specPattern = greppedSpecs)
122125
: (config.testFiles = greppedSpecs)
123126
} else {

src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ function parseTagsGrep(s) {
7777
})
7878

7979
// filter out undefined from explicit not tags
80-
const ORS_filtered = ORS.filter(x => x !==undefined)
81-
if(explicitNotTags.length > 0 ){
80+
const ORS_filtered = ORS.filter((x) => x !== undefined)
81+
if (explicitNotTags.length > 0) {
8282
ORS_filtered.forEach((OR, index) => {
8383
ORS_filtered[index] = OR.concat(explicitNotTags)
8484
})

0 commit comments

Comments
 (0)