@bahmutov/cy-grep 1.9.0 → 1.9.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 +2 -1
- package/package.json +5 -4
- package/src/plugin.js +1 -1
- package/src/utils.js +12 -1
package/README.md
CHANGED
@@ -486,7 +486,7 @@ When you run the tests now, this test will be skipped, as if it were `it.skip`.
|
|
486
486
|
|
487
487
|
If `grepFilterSpecs=true` and a spec has only required tags, and you are running without any tags, the the spec will be skipped completely.
|
488
488
|
|
489
|
-
Read the blog
|
489
|
+
Read the blog posts 📝 [Required Tags](https://glebbahmutov.com/blog/required-tags/) and [Use Required Test Tags Instead Of Skipping Tests](https://glebbahmutov.com/blog/required-tags-instead-of-skipped-tests/).
|
490
490
|
|
491
491
|
## Negative grep
|
492
492
|
|
@@ -685,6 +685,7 @@ To see how to debug this plugin, watch the video [Debug cypress-grep Plugin](htt
|
|
685
685
|
|
686
686
|
- [cypress-select-tests](https://github.com/bahmutov/cypress-select-tests)
|
687
687
|
- [cypress-skip-test](https://github.com/cypress-io/cypress-skip-test)
|
688
|
+
- 📝 Read the blog post [Cypress GitHub Actions Slash Command](https://glebbahmutov.com/blog/cypress-slash-command/)
|
688
689
|
|
689
690
|
## cy-grep vs cypress-grep vs @cypress/grep
|
690
691
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bahmutov/cy-grep",
|
3
|
-
"version": "1.9.
|
3
|
+
"version": "1.9.2",
|
4
4
|
"description": "Filter Cypress tests using title or tags",
|
5
5
|
"main": "src/support.js",
|
6
6
|
"scripts": {
|
@@ -8,14 +8,14 @@
|
|
8
8
|
"cy:open": "cypress open --e2e -b electron --config specPattern='**/unit.js'",
|
9
9
|
"badges": "npx -p dependency-version-badge update-badge cypress",
|
10
10
|
"semantic-release": "semantic-release",
|
11
|
-
"deps": "npm audit --report --omit dev"
|
11
|
+
"deps": "npm audit --report --omit dev",
|
12
|
+
"stop-only": "stop-only --folder cypress/e2e"
|
12
13
|
},
|
13
14
|
"dependencies": {
|
14
15
|
"cypress-plugin-config": "^1.2.0",
|
15
16
|
"debug": "^4.3.2",
|
16
17
|
"find-cypress-specs": "^1.29.4",
|
17
|
-
"find-test-names": "1.28.3"
|
18
|
-
"globby": "^11.0.4"
|
18
|
+
"find-test-names": "1.28.3"
|
19
19
|
},
|
20
20
|
"devDependencies": {
|
21
21
|
"cypress": "12.8.1",
|
@@ -23,6 +23,7 @@
|
|
23
23
|
"cypress-expect": "^3.1.0",
|
24
24
|
"prettier": "^2.8.1",
|
25
25
|
"semantic-release": "^20.1.3",
|
26
|
+
"stop-only": "^3.3.1",
|
26
27
|
"typescript": "^4.7.4"
|
27
28
|
},
|
28
29
|
"peerDependencies": {
|
package/src/plugin.js
CHANGED
@@ -114,7 +114,7 @@ function cypressGrepPlugin(config) {
|
|
114
114
|
} else if (grepTags) {
|
115
115
|
const parsedGrep = parseGrep(null, grepTags, grepPrefixAt)
|
116
116
|
debug('parsed grep tags %o', parsedGrep)
|
117
|
-
const mentionedTags = getMentionedTags(grepTags)
|
117
|
+
const mentionedTags = getMentionedTags(grepTags, grepPrefixAt)
|
118
118
|
debug('user mentioned tags %o', mentionedTags)
|
119
119
|
// unique tags found across all specs we search
|
120
120
|
const foundTags = new Set()
|
package/src/utils.js
CHANGED
@@ -118,9 +118,11 @@ function parseTagsGrep(s, grepPrefixAt = false) {
|
|
118
118
|
* Given a user string of tags to find, with various connectors,
|
119
119
|
* returns the list of just the tags themselves. Could be used to
|
120
120
|
* quickly filter test specs or find misspelled tags.
|
121
|
+
* @param {string} s String of tags passed by the user
|
122
|
+
* @param {boolean} grepPrefixAt Enforce the `@` character at the start of each tag
|
121
123
|
* @returns {string[]} list of unique tags
|
122
124
|
*/
|
123
|
-
function getMentionedTags(s) {
|
125
|
+
function getMentionedTags(s, grepPrefixAt = false) {
|
124
126
|
if (!s) {
|
125
127
|
return []
|
126
128
|
}
|
@@ -132,6 +134,15 @@ function getMentionedTags(s) {
|
|
132
134
|
// remove any "-" at the start of the tag
|
133
135
|
// because these are to signal inverted tags
|
134
136
|
.map((s) => (s.startsWith('-') ? s.slice(1) : s))
|
137
|
+
.map((tag) => {
|
138
|
+
if (grepPrefixAt) {
|
139
|
+
if (!tag.startsWith('@')) {
|
140
|
+
return '@' + tag
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
return tag
|
145
|
+
})
|
135
146
|
const uniqueTags = [...new Set(tags)]
|
136
147
|
return uniqueTags.sort()
|
137
148
|
}
|