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

Commit 92738a0

Browse files
Narretzbahmutov
andauthored
test: Runs before and beforeEach when first test is skipped (#102)
Closes #61 Co-authored-by: Gleb Bahmutov <bahmutov@yahoo.com>
1 parent be51e38 commit 92738a0

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,14 @@ jobs:
397397
--env grep=loads,grepOmitFiltered=true,grepFilterSpecs=true \
398398
--expect-exactly expects/ts-spec.json
399399
400+
- name: run before and beforeEach fn when the first test is filtered 🧪
401+
run: |
402+
npx cypress-expect \
403+
--env grepTags=@staging \
404+
--spec cypress/integration/before-spec.js \
405+
--config testFiles="before-spec.js" \
406+
--expect ./expects/before.json
407+
400408
- name: inherits parent tags 🧪
401409
run: |
402410
npx cypress-expect \

cypress/integration/before-spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
describe('Runs before and beforeEach when first test is skipped', () => {
2+
let count = 0
3+
4+
before(() => {
5+
count++
6+
})
7+
8+
beforeEach(() => {
9+
count++
10+
})
11+
12+
it('A', { tags: ['@core'] }, () => {})
13+
14+
it('B', { tags: ['@core', '@staging'] }, () => {
15+
expect(count).to.equal(2)
16+
})
17+
})

expects/before.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"Runs before and beforeEach when first test is skipped": {
3+
"A": "pending",
4+
"B": "passed"
5+
}
6+
}

0 commit comments

Comments
 (0)