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

Commit d6cd15a

Browse files
authored
fix: support specify alias to it, closes #82 (#83)
1 parent 44ef6a5 commit d6cd15a

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ jobs:
177177
--env grepTags=@smoke \
178178
--expect expects/describe-tags-spec.json
179179
180+
- name: Specify is an alias to it 🧪
181+
run: |
182+
npx cypress-expect \
183+
--spec cypress/integration/specify-spec.js \
184+
--config testFiles="specify-spec.js" \
185+
--env grep="works 2" \
186+
--expect-exactly expects/specify.json
187+
180188
tests3:
181189
runs-on: ubuntu-20.04
182190
needs: install

cypress/integration/specify-spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/// <reference types="cypress" />
2+
3+
// specify is the same as it()
4+
5+
specify('hello world', () => {})
6+
7+
specify('works', () => {})
8+
9+
specify('works 2 @tag1', { tags: '@tag1' }, () => {})
10+
11+
specify('works 2 @tag1 @tag2', { tags: ['@tag1', '@tag2'] }, () => {})
12+
13+
specify('works @tag2', { tags: '@tag2' }, () => {})

expects/specify.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/support.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,12 @@ function cypressGrep() {
162162
return
163163
}
164164

165-
// overwrite "context" which is an alias to describe
165+
// overwrite "context" which is an alias to "describe"
166166
context = describe
167167

168+
// overwrite "specify" which is an alias to "it"
169+
specify = it
170+
168171
// keep the ".skip", ".only" methods the same as before
169172
it.skip = _it.skip
170173
it.only = _it.only

0 commit comments

Comments
 (0)