@bahmutov/cy-grep 1.5.0 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -41,6 +41,7 @@ Watch the video [intro to cypress-grep plugin](https://www.youtube.com/watch?v=H
41
41
  - [Install](#install)
42
42
  - [Support file](#support-file)
43
43
  - [Config file](#config-file)
44
+ - [Install in Cypress versions before 10](#install-in-cypress-versions-before-10)
44
45
  - [Usage Overview](#usage-overview)
45
46
  - [Filter by test title](#filter-by-test-title)
46
47
  - [OR substring matching](#or-substring-matching)
@@ -140,6 +141,37 @@ module.exports = defineConfig({
140
141
  })
141
142
  ```
142
143
 
144
+ ### Install in Cypress versions before 10
145
+
146
+ See [test-cy-v9](./test-cy-v9/) for example
147
+
148
+ ```js
149
+ // cypress/plugins/index.js
150
+ module.exports = (on, config) => {
151
+ // `on` is used to hook into various events Cypress emits
152
+ // `config` is the resolved Cypress config
153
+ require('@bahmutov/cy-grep/src/plugin')(config)
154
+ // IMPORTANT: return the config object
155
+ return config
156
+ }
157
+ ```
158
+
159
+ ```js
160
+ // cypress/support/index.js
161
+ require('@bahmutov/cy-grep')()
162
+ ```
163
+
164
+ Put the common settings into `cypress.json`
165
+
166
+ ```json
167
+ {
168
+ "env": {
169
+ "grepOmitFiltered": true,
170
+ "grepFilterSpecs": true
171
+ }
172
+ }
173
+ ```
174
+
143
175
  ## Usage Overview
144
176
 
145
177
  You can filter tests to run using part of their title via `grep`, and via explicit tags via `grepTags` Cypress environment variables.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmutov/cy-grep",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Filter Cypress tests using title or tags",
5
5
  "main": "src/support.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@
26
26
  "typescript": "^4.7.4"
27
27
  },
28
28
  "peerDependencies": {
29
- "cypress": ">=10"
29
+ "cypress": ">=8"
30
30
  },
31
31
  "files": [
32
32
  "src"
package/src/plugin.js CHANGED
@@ -176,13 +176,14 @@ function cypressGrepPlugin(config) {
176
176
  const relativeNames = greppedSpecs.map((filename) =>
177
177
  path.relative(integrationFolder, filename),
178
178
  )
179
+ const relativeSpecs = relativeNames.join(', ')
179
180
  debug(
180
181
  'specs in the integration folder %s %s',
181
182
  integrationFolder,
182
- relativeNames.join(', '),
183
+ relativeSpecs,
183
184
  )
184
185
  // @ts-ignore
185
- config.testFiles = relativeNames.join(',')
186
+ config.testFiles = relativeNames
186
187
  } else {
187
188
  debug('setting selected %d specs (>= v10)', greppedSpecs.length)
188
189
  // @ts-ignore