cypress-plugin-grep-boxes 2.4.0 → 3.0.1

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.
package/README.md CHANGED
@@ -54,11 +54,11 @@ registerCypressGrep();
54
54
 
55
55
  ## 🦺 Setup
56
56
 
57
- **Recommended**: Set two common environment variables tied to the `@bahmutov/cy-grep` package to enhance the experience utilizing the grep logic within the Cypress Test Runner UI using cypress open:
57
+ **Recommended**: Set two common expose variables tied to the `@bahmutov/cy-grep` package to enhance the experience utilizing the grep logic within the Cypress Test Runner UI using cypress open:
58
58
 
59
59
  ```json
60
60
  {
61
- "env": {
61
+ "expose": {
62
62
  "grepOmitFiltered": true,
63
63
  "grepFilterSpecs": true
64
64
  }
@@ -98,19 +98,19 @@ it('deletes an item', { requiredTags: '@skip' }, () => {
98
98
  });
99
99
  ```
100
100
 
101
- Now running or opening Cypress in interactive mode, **you will not see any tests with `requiredTags` including `@skip`** (unless setting environment variable `grepTags=@skip`).
101
+ Now running or opening Cypress in interactive mode, **you will not see any tests with `requiredTags` including `@skip`** (unless setting expose variable `grepTags=@skip`).
102
102
 
103
103
  To run just those tests with the required tag `@skip` in interactive mode:
104
104
 
105
105
  ```bash
106
- npx cypress open --env grepTags=@skip
106
+ npx cypress open --expose grepTags=@skip
107
107
  ```
108
108
 
109
109
  ## hideSpecTags
110
110
 
111
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
112
 
113
- If for any reason you'd like to exclude tags from being displayed in 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.
113
+ If for any reason you'd like to exclude tags from being displayed in the Cypress Test Runner, use the expose variable `hideSpecTags` set to an array of tags you do not want to be displayed in the Cypress Test Runner.
114
114
 
115
115
  ### Hide specific tags
116
116
 
@@ -118,7 +118,7 @@ Example:
118
118
 
119
119
  ```json
120
120
  {
121
- "env": {
121
+ "expose": {
122
122
  "hideSpecTags": ["@smoke", "@sanity"]
123
123
  }
124
124
  }
@@ -132,7 +132,7 @@ If you'd like to exclude all tags from being displayed in the Cypress Test Runne
132
132
 
133
133
  ```json
134
134
  {
135
- "env": {
135
+ "expose": {
136
136
  "hideSpecTags": ["*"]
137
137
  }
138
138
  }
@@ -146,7 +146,7 @@ If you'd like to ONLY display a specific subset of tags in the Cypress Test Runn
146
146
 
147
147
  ```json
148
148
  {
149
- "env": {
149
+ "expose": {
150
150
  "hideSpecTags": ["*", "+@smoke", "+@sanity"]
151
151
  }
152
152
  }
@@ -158,22 +158,22 @@ The example above would hide all tags EXCEPT `@smoke` and `@sanity` tags in the
158
158
 
159
159
  Cypress Test Runner UI automatically runs available tests once a spec file is open.
160
160
 
161
- To prevent this behavior to have control of when and which tests to run, add the environment variable `disableInitialAutoRun=true`:
161
+ To prevent this behavior to have control of when and which tests to run, add the expose variable `disableInitialAutoRun=true`:
162
162
 
163
163
  ![disableInitialAutoRun_demo](https://github.com/user-attachments/assets/95fc4807-847b-432e-9b03-dc4fbe9f955a)
164
164
 
165
165
  ```bash
166
166
  # Example via CLI
167
- npx cypress open --env disableInitialAutoRun=true
167
+ npx cypress open --expose disableInitialAutoRun=true
168
168
  ```
169
169
 
170
- **Tip:** you can set this environment variable in the [config file](https://docs.cypress.io/guides/references/configuration) file to enable it by default and skip using the environment variable:
170
+ **Tip:** you can set this expose variable in the [config file](https://docs.cypress.io/guides/references/configuration) file to enable it by default and skip using the expose variable:
171
171
 
172
172
  ```js
173
173
  // config file
174
174
  {
175
175
  "e2e": {
176
- "env": {
176
+ "expose": {
177
177
  "disableInitialAutoRun": true
178
178
  }
179
179
  }
package/cypress.config.js CHANGED
@@ -1,7 +1,8 @@
1
1
  const { defineConfig } = require('cypress');
2
2
 
3
3
  module.exports = defineConfig({
4
- env: {
4
+ allowCypressEnv: false,
5
+ expose: {
5
6
  grepOmitFiltered: true,
6
7
  grepFilterSpecs: true,
7
8
  },
package/index.js CHANGED
@@ -247,7 +247,7 @@ if (Cypress.config('isInteractive')) {
247
247
  if (Cypress.config('isInteractive')) {
248
248
  if (
249
249
  // if the grep test toggle is not checked, do not run tests
250
- Cypress.env('disableInitialAutoRun') &&
250
+ Cypress.expose('disableInitialAutoRun') &&
251
251
  window.top?.document.querySelectorAll('#grepTestToggle:checked').length ===
252
252
  0
253
253
  ) {
@@ -368,7 +368,7 @@ export const addTags = () => {
368
368
  outline: none;
369
369
  }
370
370
  `;
371
- if (Cypress.env('specTags')) {
371
+ if (Cypress.expose('specTags')) {
372
372
  const hasStyles = window.top?.document.querySelector('#tagPillStyle');
373
373
 
374
374
  if (!hasStyles) {
@@ -391,7 +391,7 @@ export const addTags = () => {
391
391
  }
392
392
  const title = header.querySelector('.runnable-title');
393
393
  const testName = title.innerText.split('\n')[0];
394
- const allSpecTags = Cypress.env('specTags');
394
+ const allSpecTags = Cypress.expose('specTags');
395
395
  const testTag = getTagsForTitle(testName, allSpecTags);
396
396
  if (t.querySelectorAll('[data-attribute="test-tags"]').length === 0) {
397
397
  renderTagPills(testTag, title);
@@ -406,7 +406,7 @@ function getTagsForTitle(title, fullTagsObj) {
406
406
 
407
407
  const allTags = [...test.effectiveTestTags, ...test.requiredTestTags];
408
408
 
409
- let raw = Cypress.env('hideSpecTags');
409
+ let raw = Cypress.expose('hideSpecTags');
410
410
  if (!raw) return allTags;
411
411
 
412
412
  let rules = Array.isArray(raw)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-plugin-grep-boxes",
3
- "version": "2.4.0",
3
+ "version": "3.0.1",
4
4
  "description": "Cypress plugin that allows user to run specific tests in open mode.",
5
5
  "main": "./index.js",
6
6
  "keywords": [
@@ -9,8 +9,8 @@
9
9
  "cypress-plugin"
10
10
  ],
11
11
  "devDependencies": {
12
- "@bahmutov/cy-grep": "^2.1.0",
13
- "cypress": "^15.11.0"
12
+ "@bahmutov/cy-grep": "^3.0.1",
13
+ "cypress": "^15.12.0"
14
14
  },
15
15
  "publishConfig": {
16
16
  "registry": "https://registry.npmjs.org/"