Skip to content

Commit d102a4b

Browse files
committed
Add addCucumberPreprocessorPlugin() to the examples
1 parent 4ef5f8d commit d102a4b

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
import * as browserify from "@cypress/browserify-preprocessor";
2+
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
23
import { preprocessor } from "@badeball/cypress-cucumber-preprocessor/browserify";
34

4-
export default (
5+
export default async (
56
on: Cypress.PluginEvents,
67
config: Cypress.PluginConfigOptions
7-
): void => {
8+
): Promise<Cypress.PluginConfigOptions> => {
9+
await addCucumberPreprocessorPlugin(on, config);
10+
811
on(
912
"file:preprocessor",
1013
preprocessor(config, {
1114
...browserify.defaultOptions,
1215
typescript: require.resolve("typescript"),
1316
})
1417
);
18+
19+
// Make sure to return the config object as it might have been modified by the plugin.
20+
return config;
1521
};
Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
import * as createBundler from "@bahmutov/cypress-esbuild-preprocessor";
2+
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
23
import { createEsbuildPlugin } from "@badeball/cypress-cucumber-preprocessor/esbuild";
34

4-
export default (
5+
export default async (
56
on: Cypress.PluginEvents,
67
config: Cypress.PluginConfigOptions
7-
): void => {
8+
): Promise<Cypress.PluginConfigOptions> => {
9+
await addCucumberPreprocessorPlugin(on, config);
10+
811
on(
912
"file:preprocessor",
1013
createBundler({
1114
plugins: [createEsbuildPlugin(config)],
1215
})
1316
);
17+
18+
// Make sure to return the config object as it might have been modified by the plugin.
19+
return config;
1420
};

examples/webpack/cypress/plugins/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import * as webpack from "@cypress/webpack-preprocessor";
2+
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
23

3-
export default (
4+
export default async (
45
on: Cypress.PluginEvents,
56
config: Cypress.PluginConfigOptions
6-
): void => {
7+
): Promise<Cypress.PluginConfigOptions> => {
8+
await addCucumberPreprocessorPlugin(on, config);
9+
710
on(
811
"file:preprocessor",
912
webpack({
@@ -36,4 +39,7 @@ export default (
3639
},
3740
})
3841
);
42+
43+
// Make sure to return the config object as it might have been modified by the plugin.
44+
return config;
3945
};

0 commit comments

Comments
 (0)