cypress-plugin-grep-boxes 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +19 -0
  2. package/index.js +7 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -20,6 +20,7 @@ A companion Cypress plugin for <code>cy-grep</code> that allows user to run spec
20
20
  - [Open mode](#-open-mode)
21
21
  - [Using cypress-plugin-filter-runnables](#using-cypress-plugin-filter-runnables)
22
22
  - [Use Required Test Tags Instead Of Skipping Tests](#use-required-test-tags-instead-of-skipping-tests)
23
+ - [hideSpecTags](#hideSpecTags)
23
24
  - [disableInitialAutoRun](#disableInitialAutoRun)
24
25
  - [Contributions](#contributions)
25
26
 
@@ -105,6 +106,24 @@ To run just those tests with the required tag `@skip` in interactive mode:
105
106
  npx cypress open --env grepTags=@skip
106
107
  ```
107
108
 
109
+ ## hideSpecTags
110
+
111
+ The `cypress-plugin-grep-boxes` plugin (new in v2.0.0) displays all available `effectiveTestTags` in the Cypress Test Runner for each test.
112
+
113
+ If for any reason you'd like to exclude specific tags from being added to the Cypress Test Runner, use the environment variable `hideSpecTags` set to an array of tags you do not want to be displayed in the Cypress Test Runner.
114
+
115
+ Example:
116
+
117
+ ```json
118
+ {
119
+ "env": {
120
+ "hideSpecTags": ["@smoke", "@sanity"]
121
+ }
122
+ }
123
+ ```
124
+
125
+ The example above would not add any tags to Cypress Test Runner titled `@smoke` and `@sanity`.
126
+
108
127
  ## disableInitialAutoRun
109
128
 
110
129
  Cypress Test Runner UI automatically runs available tests once a spec file is open.
package/index.js CHANGED
@@ -406,7 +406,13 @@ function getTagsForTitle(title, fullTagsObj) {
406
406
  return []; // Title not found
407
407
  }
408
408
 
409
- return [...test.effectiveTestTags, ...test.requiredTestTags];
409
+ const allTags = [...test.effectiveTestTags, ...test.requiredTestTags];
410
+ const tagsToExclude = Cypress.env('hideSpecTags');
411
+
412
+ if (!tagsToExclude?.length) return allTags;
413
+
414
+ // Filter out excluded tags
415
+ return allTags.filter((tag) => !tagsToExclude?.includes(tag));
410
416
  }
411
417
 
412
418
  function renderTagPills(tags, container) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-plugin-grep-boxes",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Cypress plugin that allows user to run specific tests in open mode.",
5
5
  "main": "./index.js",
6
6
  "keywords": [