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

Commit ca58e2d

Browse files
committed
fix: convert grep to String before using, closes #91
1 parent 4620196 commit ca58e2d

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ jobs:
114114
--env grep=@tag1 \
115115
--expect ./expects/tag1.json
116116
117+
- name: Run tests with number 1 🧪
118+
run: |
119+
npx cypress-expect run \
120+
--env grep=1 \
121+
--expect ./expects/number1.json
122+
117123
- name: Run tests with "@tag2" 🧪
118124
run: |
119125
npx cypress-expect \

expects/number1.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"hello world": "pending",
3+
"works": "pending",
4+
"works 2 @tag1": "passed",
5+
"works 2 @tag1 @tag2": "passed",
6+
"works @tag2": "pending"
7+
}

src/plugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function cypressGrepPlugin(config) {
1616

1717
debug('Cypress config env object: %o', config.env)
1818
debug('plugin version %s', version)
19-
const grep = config.env.grep
19+
const grep = config.env.grep ? String(config.env.grep) : undefined
2020
if (grep) {
2121
console.log('cypress-grep: tests with "%s" in their names', grep.trim())
2222
}

src/support.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function cypressGrep() {
1818
/** @type {string} Part of the test title go grep */
1919
let grep = Cypress.env('grep')
2020
if (grep) {
21-
grep = grep.trim()
21+
grep = String(grep).trim()
2222
}
2323

2424
/** @type {string} Raw tags to grep string */

0 commit comments

Comments
 (0)