You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,8 @@ Other changees:
22
22
23
23
- Support project directories containing square brackets, EG. `/home/[foo] my project/`, relates to [#1196](https://github.com/badeball/cypress-cucumber-preprocessor/discussions/1196).
24
24
25
+
- Allow features in arbitrary locations, fixes [#1225](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1225).
26
+
25
27
## v20.1.2
26
28
27
29
- Updated all dependencies, including esbuild, relates to [#1068](https://github.com/badeball/cypress-cucumber-preprocessor/issues/1068).
Copy file name to clipboardExpand all lines: docs/step-definitions.md
+34-1Lines changed: 34 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
# Step definitions
4
4
5
-
Step definitions are resolved using search paths that are configurable through the `stepDefinitions` property. The preprocessor uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig), which means you can place configuration options in EG. `.cypress-cucumber-preprocessorrc.json` or `package.json`. The default search paths are shown below.
5
+
Step definitions are resolved using search paths that are configurable through the `stepDefinitions` property. The preprocessor uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig), which means you can place configuration options in EG. `.cypress-cucumber-preprocessorrc.json` or `package.json`. The default (almost true[^1]) search paths are shown below.
6
6
7
7
```json
8
8
{
@@ -147,3 +147,36 @@ All of these will be used to replace `[filepart]`. Thus, a single configuration
147
147
The library makes use of [glob](https://github.com/isaacs/node-glob) to turn patterns into a list of files. This has some implications, explained below (list is non-exhaustive and will be expanded on demand).
148
148
149
149
* Single term inside braces, EG. `foo/bar.{js}`, doesn't work as you might expect, ref. https://github.com/isaacs/node-glob/issues/434.
150
+
151
+
[^1]: I claim that the default configuration is of that below and this is almost always true.
152
+
153
+
```json
154
+
{
155
+
"stepDefinitions": [
156
+
"cypress/e2e/[filepath]/**/*.{js,ts}",
157
+
"cypress/e2e/[filepath].{js,ts}",
158
+
"cypress/support/step_definitions/**/*.{js,ts}",
159
+
]
160
+
}
161
+
```
162
+
163
+
The reality is a bit more complex, in order to support a variety of use-cases out-of-the-box.
164
+
Most users will place their feature files in `cypress/e2e` and in those cases, the default
165
+
configuration will be that of my claim.
166
+
167
+
However, users that decide on a different location, let's say. `cypress/features` - in their
168
+
case, the default behavior of the preprocessor will be _as if_ you configured `stepDefinitions`
169
+
shown like below.
170
+
171
+
```json
172
+
{
173
+
"stepDefinitions": [
174
+
"cypress/features/[filepath]/**/*.{js,ts}",
175
+
"cypress/features/[filepath].{js,ts}",
176
+
"cypress/support/step_definitions/**/*.{js,ts}",
177
+
]
178
+
}
179
+
```
180
+
181
+
Essentially, the first part of the two first elements, is determined finding out the common
182
+
ancestor path of all your feature files and thus the default configuration is dynamic.
0 commit comments