@bahmutov/cy-grep 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/support.js +16 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmutov/cy-grep",
3
- "version": "1.4.1",
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,7 +12,7 @@
12
12
  "dependencies": {
13
13
  "cypress-plugin-config": "^1.2.0",
14
14
  "debug": "^4.3.2",
15
- "find-test-names": "1.25.1",
15
+ "find-test-names": "1.26.0",
16
16
  "globby": "^11.0.4"
17
17
  },
18
18
  "devDependencies": {
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