File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ # Mixing Cucumber and non-Cucumber specs
2+
3+ Mixing Cucumber and non-Cucumber specs are supported. Cypress can be configured with ` specPattern ` to resolve multiple spec types as shown below.
4+
5+ ``` js
6+ export default defineConfig ({
7+ e2e: {
8+ specPattern: " **/*.{spec.js,feature}"
9+ },
10+ });
11+ ```
12+
13+ Cucumber hooks, IE. ` Before ` and ` After ` as imported from ` @badeball/cypress-cucumber-preprocessor ` , are * only* run in Cucumber-type specs.
14+
15+ You can determine spec-type in Cypress' own hooks using ` isFeature() ` , as shown below.
16+
17+ ``` js
18+ import { isFeature } from " @badeball/cypress-cucumber-preprocessor" ;
19+
20+ beforeEach (() => {
21+ if (isFeature ()) {
22+ // This is only run for Cucumber-type specs.
23+ }
24+ })
25+ ```
26+
27+ You can also created conditions based on tags using ` doesFeatureMatch(..) ` , as shown below.
28+
29+ ``` js
30+ import { isFeature , doesFeatureMatch } from " @badeball/cypress-cucumber-preprocessor" ;
31+
32+ beforeEach (() => {
33+ if (isFeature () && doesFeatureMatch (" @foobar" )) {
34+ // This is only run for Cucumber-type specs tagged with @foobar.
35+ }
36+ })
37+ ```
Original file line number Diff line number Diff line change 1414* [ Configuration] ( configuration.md )
1515* [ Test configuration] ( test-configuration.md )
1616* [ Diagnostics / dry run] ( diagnostics.md )
17+ * [ Mixing Cucumber and non-Cucumber specs] ( mixing-types.md )
1718* [ Frequently asked questions] ( faq.md )
You can’t perform that action at this time.
0 commit comments