k6-cucumber-steps 1.2.3 → 1.2.5
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.
- package/bin/k6-cucumber-steps.js +49 -9
- package/package.json +1 -1
package/bin/k6-cucumber-steps.js
CHANGED
|
@@ -94,9 +94,57 @@ program
|
|
|
94
94
|
|
|
95
95
|
// Add other options as needed...
|
|
96
96
|
|
|
97
|
-
const finalCommand = [
|
|
97
|
+
const finalCommand = [
|
|
98
|
+
"npx",
|
|
99
|
+
"cucumber-js",
|
|
100
|
+
...cliParts
|
|
101
|
+
].join(" ");
|
|
102
|
+
|
|
98
103
|
console.log("▶️ Final arguments passed to cucumber-js:", finalCommand);
|
|
99
104
|
|
|
105
|
+
// Collect options to pass as env vars
|
|
106
|
+
const extraEnv = {
|
|
107
|
+
// Priority: cucumberConfig > CLI > process.env
|
|
108
|
+
SAVE_K6_SCRIPT:
|
|
109
|
+
cucumberConfig.saveK6Script === true ||
|
|
110
|
+
argv.saveK6Script === true ||
|
|
111
|
+
process.env.SAVE_K6_SCRIPT === "true"
|
|
112
|
+
? "true"
|
|
113
|
+
: "false",
|
|
114
|
+
K6_CUCUMBER_OVERWRITE:
|
|
115
|
+
cucumberConfig.overwrite === true ||
|
|
116
|
+
argv.overwrite === true ||
|
|
117
|
+
process.env.K6_CUCUMBER_OVERWRITE === "true"
|
|
118
|
+
? "true"
|
|
119
|
+
: "false",
|
|
120
|
+
CLEAN_REPORTS:
|
|
121
|
+
cucumberConfig.cleanReports === true ||
|
|
122
|
+
argv.cleanReports === true ||
|
|
123
|
+
argv.clean === true ||
|
|
124
|
+
process.env.CLEAN_REPORTS === "true"
|
|
125
|
+
? "true"
|
|
126
|
+
: "false",
|
|
127
|
+
K6_CUCUMBER_REPORTER:
|
|
128
|
+
cucumberConfig.reporter === true ||
|
|
129
|
+
argv.reporter === true ||
|
|
130
|
+
process.env.K6_CUCUMBER_REPORTER === "true"
|
|
131
|
+
? "true"
|
|
132
|
+
: "false",
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// Now print environment variables (after extraEnv is defined)
|
|
136
|
+
console.log("▶️ Environment variables passed to cucumber-js:");
|
|
137
|
+
Object.entries(extraEnv).forEach(([key, value]) => {
|
|
138
|
+
console.log(` ${key}=${value}`);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
console.log("▶️ CLI flags passed:");
|
|
142
|
+
Object.entries(argv).forEach(([key, value]) => {
|
|
143
|
+
if (typeof value !== "function" && typeof value !== "undefined") {
|
|
144
|
+
console.log(` --${key}=${value}`);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
100
148
|
// Clean reports directory if requested
|
|
101
149
|
const shouldCleanReports =
|
|
102
150
|
argv.cleanReports ||
|
|
@@ -113,14 +161,6 @@ program
|
|
|
113
161
|
}
|
|
114
162
|
}
|
|
115
163
|
|
|
116
|
-
// Collect options to pass as env vars
|
|
117
|
-
const extraEnv = {
|
|
118
|
-
SAVE_K6_SCRIPT: argv.saveK6Script === true || process.env.SAVE_K6_SCRIPT === "true" || cucumberConfig.saveK6Script === true ? "true" : "false",
|
|
119
|
-
K6_CUCUMBER_OVERWRITE: argv.overwrite === true || process.env.K6_CUCUMBER_OVERWRITE === "true" || cucumberConfig.overwrite === true ? "true" : "false",
|
|
120
|
-
CLEAN_REPORTS: argv.cleanReports === true || argv.clean === true || process.env.CLEAN_REPORTS === "true" || cucumberConfig.cleanReports === true ? "true" : "false",
|
|
121
|
-
K6_CUCUMBER_REPORTER: argv.reporter === true || process.env.K6_CUCUMBER_REPORTER === "true" || cucumberConfig.reporter === true ? "true" : "false",
|
|
122
|
-
};
|
|
123
|
-
|
|
124
164
|
// Now spawn the process
|
|
125
165
|
const cucumberProcess = spawn(
|
|
126
166
|
"npx",
|