Skip to content

Commit cac92b0

Browse files
committed
Validate that addCucumberPreprocessorPlugin has been invoked
This allows me to not mention it everywhere in the docs, which became tiring. This is also a preperation for adding another page which would otherwise have had to mention it.
1 parent 2f9fcae commit cac92b0

File tree

22 files changed

+98
-73
lines changed

22 files changed

+98
-73
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file.
66

77
- Total execution time is correctly shown in HTML reports, fixes [#813](https://github.com/badeball/cypress-cucumber-preprocessor/issues/813).
88

9+
- Validate inclusion of `addCucumberPreprocessorPlugin()` in `setupNodeEvents()`, fixes [#820](https://github.com/badeball/cypress-cucumber-preprocessor/issues/820).
10+
911
## v12.1.0
1012

1113
- Start time and execution time is shown in HTML reports, fixes [#798](https://github.com/badeball/cypress-cucumber-preprocessor/issues/798).

docs/html-report.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,3 @@ HTML reports can be enabled using the `html.enabled` property. The preprocessor
99
}
1010
}
1111
```
12-
13-
This **requires** you to have registered this module in your [configuration file](https://docs.cypress.io/guides/references/configuration#Configuration-File), as shown below.
14-
15-
```ts
16-
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
17-
18-
export default defineConfig({
19-
e2e: {
20-
async setupNodeEvents(
21-
on: Cypress.PluginEvents,
22-
config: Cypress.PluginConfigOptions
23-
) {
24-
await addCucumberPreprocessorPlugin(on, config);
25-
26-
// Make sure to return the config object as it might have been modified by the plugin.
27-
return config;
28-
},
29-
},
30-
});
31-
```

docs/json-report.md

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,7 @@ JSON reports can be enabled using the `json.enabled` property. The preprocessor
1010
}
1111
```
1212

13-
This **requires** you to have registered this module in your [configuration file](https://docs.cypress.io/guides/references/configuration#Configuration-File), as shown below.
14-
15-
```ts
16-
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
17-
18-
export default defineConfig({
19-
e2e: {
20-
async setupNodeEvents(
21-
on: Cypress.PluginEvents,
22-
config: Cypress.PluginConfigOptions
23-
) {
24-
await addCucumberPreprocessorPlugin(on, config);
25-
26-
// Make sure to return the config object as it might have been modified by the plugin.
27-
return config;
28-
},
29-
},
30-
});
31-
```
32-
33-
This also **requires** you to have downloaded and installed the [cucumber-json-formatter](https://github.com/cucumber/json-formatter) **yourself**. Arch Linux users can install it from [AUR](https://aur.archlinux.org/packages/cucumber-json-formatter).
13+
This **requires** you to have downloaded and installed the [cucumber-json-formatter](https://github.com/cucumber/json-formatter) **yourself**. Arch Linux users can install it from [AUR](https://aur.archlinux.org/packages/cucumber-json-formatter).
3414

3515
The location of the executable is configurable through the `json.formatter` property, but it will by default search for `cucumber-json-formatter` in your `PATH`.
3616

docs/quick-start.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default defineConfig({
2121
on: Cypress.PluginEvents,
2222
config: Cypress.PluginConfigOptions
2323
): Promise<Cypress.PluginConfigOptions> {
24+
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
2425
await addCucumberPreprocessorPlugin(on, config);
2526

2627
on(

docs/tags.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,7 @@ Tags are inherited by child elements. Tags that are placed above a `Feature` wil
3737

3838
## Running a subset of scenarios
3939

40-
Normally when running a subset of scenarios using `cypress run --env tags=@foo`, you could potentially encounter files containing no matching scenarios. These can be pre-filtered away by setting `filterSpecs` to `true`, thus saving you execution time. This **requires** you to have registered this module in your [configuration file](https://docs.cypress.io/guides/references/configuration#Configuration-File), as shown below.
41-
42-
```ts
43-
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
44-
45-
export default defineConfig({
46-
e2e: {
47-
async setupNodeEvents(
48-
on: Cypress.PluginEvents,
49-
config: Cypress.PluginConfigOptions
50-
) {
51-
await addCucumberPreprocessorPlugin(on, config);
52-
53-
// Make sure to return the config object as it might have been modified by the plugin.
54-
return config;
55-
},
56-
},
57-
});
58-
```
40+
Normally when running a subset of scenarios using `cypress run --env tags=@foo`, you could potentially encounter files containing no matching scenarios. These can be pre-filtered away by setting `filterSpecs` to `true`, thus saving you execution time.
5941

6042
## Omit filtered tests
6143

examples/browserify-cjs/cypress.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
33
const browserify = require("@badeball/cypress-cucumber-preprocessor/browserify");
44

55
async function setupNodeEvents(on, config) {
6+
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
67
await preprocessor.addCucumberPreprocessorPlugin(on, config);
78

89
on("file:preprocessor", browserify.default(config));

examples/browserify-esm/cypress.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import preprocessor from "@badeball/cypress-cucumber-preprocessor";
33
import browserify from "@badeball/cypress-cucumber-preprocessor/browserify.js";
44

55
export async function setupNodeEvents(on, config) {
6+
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
67
await preprocessor.addCucumberPreprocessorPlugin(on, config);
78

89
on("file:preprocessor", browserify.default(config));

examples/browserify-ts/cypress.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ async function setupNodeEvents(
66
on: Cypress.PluginEvents,
77
config: Cypress.PluginConfigOptions
88
): Promise<Cypress.PluginConfigOptions> {
9+
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
910
await addCucumberPreprocessorPlugin(on, config);
1011

1112
on(

examples/esbuild-cjs/cypress.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
44
const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild");
55

66
async function setupNodeEvents(on, config) {
7+
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
78
await preprocessor.addCucumberPreprocessorPlugin(on, config);
89

910
on(

examples/esbuild-esm/cypress.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import preprocessor from "@badeball/cypress-cucumber-preprocessor";
44
import createEsbuildPlugin from "@badeball/cypress-cucumber-preprocessor/esbuild.js";
55

66
export async function setupNodeEvents(on, config) {
7+
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
78
await preprocessor.addCucumberPreprocessorPlugin(on, config);
89

910
on(

0 commit comments

Comments
 (0)