k6-cucumber-steps 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,9 +20,10 @@ program
20
20
  .option("-f, --feature <path>", "Feature file path")
21
21
  .option("-t, --tags <string>", "Cucumber tags")
22
22
  .option("-c, --config <file>", "Custom config file")
23
- .option("-r, --reporter", "Enable report generation", false)
24
- .option("-o, --overwrite", "Overwrite report files", false)
25
- .option("--cleanReports", "Clean the reports folder before running")
23
+ .option("--saveK6Script", "Keep generated k6 script files", false)
24
+ .option("--overwrite", "Overwrite report files", false)
25
+ .option("--cleanReports", "Clean the reports folder before running", false)
26
+ .option("--reporter", "Enable report generation", false)
26
27
  .option("--clean", "Alias for --cleanReports")
27
28
  .option("-p, --payloadPath <dir>", "Directory for payload files")
28
29
  .action(async (argv) => {
@@ -93,9 +94,35 @@ program
93
94
 
94
95
  // Add other options as needed...
95
96
 
96
- const finalCommand = ["npx", "cucumber-js", ...cliParts].join(" ");
97
+ const finalCommand = [
98
+ "npx",
99
+ "cucumber-js",
100
+ ...cliParts
101
+ ].join(" ");
102
+
97
103
  console.log("▶️ Final arguments passed to cucumber-js:", finalCommand);
98
104
 
105
+ // Collect options to pass as env vars
106
+ const extraEnv = {
107
+ SAVE_K6_SCRIPT: argv.saveK6Script === true || process.env.SAVE_K6_SCRIPT === "true" || cucumberConfig.saveK6Script === true ? "true" : "false",
108
+ K6_CUCUMBER_OVERWRITE: argv.overwrite === true || process.env.K6_CUCUMBER_OVERWRITE === "true" || cucumberConfig.overwrite === true ? "true" : "false",
109
+ CLEAN_REPORTS: argv.cleanReports === true || argv.clean === true || process.env.CLEAN_REPORTS === "true" || cucumberConfig.cleanReports === true ? "true" : "false",
110
+ K6_CUCUMBER_REPORTER: argv.reporter === true || process.env.K6_CUCUMBER_REPORTER === "true" || cucumberConfig.reporter === true ? "true" : "false",
111
+ };
112
+
113
+ // Now print environment variables (after extraEnv is defined)
114
+ console.log("▶️ Environment variables passed to cucumber-js:");
115
+ Object.entries(extraEnv).forEach(([key, value]) => {
116
+ console.log(` ${key}=${value}`);
117
+ });
118
+
119
+ console.log("▶️ CLI flags passed:");
120
+ Object.entries(argv).forEach(([key, value]) => {
121
+ if (typeof value !== "function" && typeof value !== "undefined") {
122
+ console.log(` --${key}=${value}`);
123
+ }
124
+ });
125
+
99
126
  // Clean reports directory if requested
100
127
  const shouldCleanReports =
101
128
  argv.cleanReports ||
@@ -113,9 +140,14 @@ program
113
140
  }
114
141
 
115
142
  // Now spawn the process
116
- const cucumberProcess = spawn("npx", ["cucumber-js", ...cliParts], {
117
- stdio: "inherit",
118
- });
143
+ const cucumberProcess = spawn(
144
+ "npx",
145
+ ["cucumber-js", ...cliParts],
146
+ {
147
+ stdio: "inherit",
148
+ env: { ...process.env, ...extraEnv },
149
+ }
150
+ );
119
151
 
120
152
  cucumberProcess.on("close", async (code) => {
121
153
  if (code === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "k6-cucumber-steps",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "repository": {