@bahmutov/cy-grep 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @bahmutov/cy-grep ![cypress version](https://img.shields.io/badge/cypress-12.4.0-brightgreen)
1
+ # @bahmutov/cy-grep ![cypress version](https://img.shields.io/badge/cypress-12.4.1-brightgreen)
2
2
 
3
3
  > Filter tests using substring or tag
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmutov/cy-grep",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Filter Cypress tests using title or tags",
5
5
  "main": "src/support.js",
6
6
  "scripts": {
@@ -12,15 +12,15 @@
12
12
  "dependencies": {
13
13
  "cypress-plugin-config": "^1.2.0",
14
14
  "debug": "^4.3.2",
15
- "find-test-names": "1.25.0",
15
+ "find-test-names": "1.26.0",
16
16
  "globby": "^11.0.4"
17
17
  },
18
18
  "devDependencies": {
19
- "cypress": "12.4.0",
19
+ "cypress": "12.4.1",
20
20
  "cypress-each": "^1.11.0",
21
21
  "cypress-expect": "^3.1.0",
22
22
  "prettier": "^2.8.1",
23
- "semantic-release": "^20.0.4",
23
+ "semantic-release": "^20.1.0",
24
24
  "typescript": "^4.7.4"
25
25
  },
26
26
  "peerDependencies": {
package/src/support.js CHANGED
@@ -110,7 +110,7 @@ function registerCyGrep() {
110
110
  .flatMap((item) => item.requiredTags)
111
111
  .concat(configRequiredTags)
112
112
  .filter(Boolean)
113
- // console.log({ nameToGrep, effectiveTestTags, requiredTestTags })
113
+ debug({ nameToGrep, effectiveTestTags, requiredTestTags })
114
114
 
115
115
  const shouldRun = shouldTestRun(
116
116
  parsedGrep,
@@ -128,7 +128,7 @@ function registerCyGrep() {
128
128
  shouldRun,
129
129
  )
130
130
  } else {
131
- debug('should test "%s" run? %s', nameToGrep, shouldRun)
131
+ debug('should test without tags "%s" run? %s', nameToGrep, shouldRun)
132
132
  }
133
133
 
134
134
  if (shouldRun) {
@@ -183,20 +183,29 @@ function registerCyGrep() {
183
183
  if (typeof configTags === 'string') {
184
184
  configTags = [configTags]
185
185
  }
186
+ let requiredTags = options && options.requiredTags
187
+ if (typeof requiredTags === 'string') {
188
+ requiredTags = [requiredTags]
189
+ }
186
190
 
187
191
  if (!configTags || !configTags.length) {
188
- // if the describe suite does not have explicit tags
189
- // move on, since the tests inside can have their own tags
190
- _describe(name, options, callback)
191
- suiteStack.pop()
192
+ if (!requiredTags || !requiredTags.length) {
193
+ // if the describe suite does not have explicit tags
194
+ // move on, since the tests inside can have their own tags
195
+ _describe(name, options, callback)
196
+ suiteStack.pop()
192
197
 
193
- return
198
+ return
199
+ }
194
200
  }
195
201
 
196
202
  // when looking at the suite of the tests, I found
197
203
  // that using the name is quickly becoming very confusing
198
204
  // and thus we need to use the explicit tags
199
205
  stackItem.tags = configTags
206
+ stackItem.requiredTags = requiredTags
207
+ debug('stack item', stackItem)
208
+
200
209
  _describe(name, options, callback)
201
210
  suiteStack.pop()
202
211