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

Commit 0f83bf6

Browse files
authored
fix: make sure it.skip tests are still skipped (#16)
* add a spec * add skip test to CI flow * fix: confirm it.only still works * update test
1 parent 6eaf375 commit 0f83bf6

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,23 @@ jobs:
2121
npx cypress-expect \
2222
--min-passing 5 --pending 0
2323
24+
- name: Run e2e skip tests without grep 🧪
25+
run: |
26+
npx cypress-expect \
27+
--passing 1 --pending 2 \
28+
--spec cypress/integration/skip-spec.js \
29+
--config testFiles="skip-spec.js"
30+
31+
# all tests are pending
32+
# because the grep tag is only used in "it.skip" tests
33+
- name: Run e2e skip tests with grep 🧪
34+
run: |
35+
npx cypress-expect \
36+
--spec cypress/integration/skip-spec.js \
37+
--config testFiles="skip-spec.js" \
38+
--env grep=pending \
39+
--expect expects/pending.json
40+
2441
# there should be 1 test with "hello" substring
2542
# and 3 other tests that will be pending
2643
- name: Run tests with "hello" 🧪

cypress/integration/skip-spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// <reference types="cypress" />
2+
describe('tests that use .skip', () => {
3+
it('works', () => {})
4+
5+
it.skip('is pending', () => {})
6+
7+
it.skip('is pending again', () => {})
8+
})

expects/pending.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"tests that use .skip": {
3+
"works": "pending",
4+
"is pending": "pending",
5+
"is pending again": "pending"
6+
}
7+
}

src/support.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ function cypressGrep() {
3535
// skip tests without grep string in their names
3636
return _it.skip(name, callback)
3737
}
38+
39+
// keep the "it.skip" the same as before
40+
it.skip = _it.skip
3841
}
3942

4043
module.exports = cypressGrep

0 commit comments

Comments
 (0)