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

Commit c88579a

Browse files
committed
fix: print debug parsed grep tags
1 parent 8e006e1 commit c88579a

File tree

5 files changed

+31
-1
lines changed

5 files changed

+31
-1
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,13 @@ jobs:
397397
--env grep=loads,grepOmitFiltered=true,grepFilterSpecs=true \
398398
--expect-exactly expects/ts-spec.json
399399
400+
- name: inherits parent tags 🧪
401+
run: |
402+
npx cypress-expect \
403+
--config testFiles="**/inherits-tag-spec.js" \
404+
--env grepTags="@smoke+@screen-b" \
405+
--expect-exactly expects/inherits-tag-spec.json
406+
400407
release:
401408
needs: [tests1, tests2, tests3]
402409
runs-on: ubuntu-20.04
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/// <reference types="cypress" />
2+
3+
describe('Screen A', { tags: ['@smoke', '@screen-a'] }, () => {
4+
it('loads', { tags: ['@screen-b'] }, () => {
5+
// do something that eventually sends the page to screen b.
6+
})
7+
})

cypress/integration/unit.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ describe('utils', () => {
7676
])
7777
})
7878

79+
it('handles dashes in the tag', () => {
80+
const parsed = parseTagsGrep('@smoke+@screen-b')
81+
expect(parsed).to.deep.equal([
82+
[
83+
{ tag: '@smoke', invert: false },
84+
{ tag: '@screen-b', invert: false },
85+
],
86+
])
87+
})
88+
7989
it('parses OR tags spaces', () => {
8090
// run tests with tag1 OR tag2 or tag3
8191
const parsed = parseTagsGrep('@tag1 @tag2 @tag3')
@@ -252,7 +262,6 @@ describe('utils', () => {
252262
// our parsing and decision logic computes the expected result
253263
const shouldIt = (used, tags, expected) => {
254264
const parsedTags = parseTagsGrep(used)
255-
console.log(parsedTags)
256265
expect(
257266
shouldTestRunTags(parsedTags, tags),
258267
`"${used}" against "${tags}"`,

expects/inherits-tag-spec.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"Screen A": {
3+
"loads": "passed"
4+
}
5+
}

src/plugin.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ function cypressGrepPlugin(config) {
2525
const grepTags = config.env.grepTags || config.env['grep-tags']
2626
if (grepTags) {
2727
console.log('cypress-grep: filtering using tag(s) "%s"', grepTags)
28+
const parsedGrep = parseGrep(null, grepTags)
29+
debug('parsed grep tags %o', parsedGrep.tags)
2830
}
2931

3032
const grepBurn =

0 commit comments

Comments
 (0)