k6-cucumber-steps 1.2.15 → 1.2.16
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 +12 -26
- package/package.json +1 -1
package/bin/k6-cucumber-steps.js
CHANGED
|
@@ -82,7 +82,7 @@ program
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
// Determine project root (where your main package.json is)
|
|
85
|
-
const projectRoot =
|
|
85
|
+
const projectRoot = process.cwd();
|
|
86
86
|
|
|
87
87
|
// Determine payload directory from CLI or config, always relative to project root
|
|
88
88
|
let payloadDirRaw =
|
|
@@ -90,9 +90,8 @@ program
|
|
|
90
90
|
(cucumberConfig.worldParameters &&
|
|
91
91
|
cucumberConfig.worldParameters.payloadPath) ||
|
|
92
92
|
"payloads";
|
|
93
|
-
const payloadDir = path.
|
|
94
|
-
|
|
95
|
-
: path.join(projectRoot, payloadDirRaw);
|
|
93
|
+
const payloadDir = path.resolve(projectRoot, payloadDirRaw);
|
|
94
|
+
console.log("📦 Resolved payload path:", payloadDir);
|
|
96
95
|
|
|
97
96
|
// Add --world-parameters to CLI args
|
|
98
97
|
const worldParams = {
|
|
@@ -109,11 +108,7 @@ program
|
|
|
109
108
|
cliParts.push("--k6Config", argv.k6Config);
|
|
110
109
|
}
|
|
111
110
|
|
|
112
|
-
const finalCommand = [
|
|
113
|
-
"npx",
|
|
114
|
-
"cucumber-js",
|
|
115
|
-
...cliParts
|
|
116
|
-
].join(" ");
|
|
111
|
+
const finalCommand = ["npx", "cucumber-js", ...cliParts].join(" ");
|
|
117
112
|
|
|
118
113
|
console.log("▶️ Final arguments passed to cucumber-js:", finalCommand);
|
|
119
114
|
|
|
@@ -121,13 +116,11 @@ program
|
|
|
121
116
|
const extraEnv = {
|
|
122
117
|
// Priority: cucumberConfig > CLI
|
|
123
118
|
SAVE_K6_SCRIPT:
|
|
124
|
-
cucumberConfig.saveK6Script === true ||
|
|
125
|
-
argv.saveK6Script === true
|
|
119
|
+
cucumberConfig.saveK6Script === true || argv.saveK6Script === true
|
|
126
120
|
? "true"
|
|
127
121
|
: "false",
|
|
128
122
|
K6_CUCUMBER_OVERWRITE:
|
|
129
|
-
cucumberConfig.overwrite === true ||
|
|
130
|
-
argv.overwrite === true
|
|
123
|
+
cucumberConfig.overwrite === true || argv.overwrite === true
|
|
131
124
|
? "true"
|
|
132
125
|
: "false",
|
|
133
126
|
CLEAN_REPORTS:
|
|
@@ -137,17 +130,14 @@ program
|
|
|
137
130
|
? "true"
|
|
138
131
|
: "false",
|
|
139
132
|
K6_CUCUMBER_REPORTER:
|
|
140
|
-
cucumberConfig.reporter === true ||
|
|
141
|
-
argv.reporter === true
|
|
133
|
+
cucumberConfig.reporter === true || argv.reporter === true
|
|
142
134
|
? "true"
|
|
143
135
|
: "false",
|
|
144
136
|
};
|
|
145
137
|
|
|
146
138
|
// Clean reports directory if requested
|
|
147
139
|
const shouldCleanReports =
|
|
148
|
-
argv.cleanReports ||
|
|
149
|
-
argv.clean ||
|
|
150
|
-
cucumberConfig.cleanReports;
|
|
140
|
+
argv.cleanReports || argv.clean || cucumberConfig.cleanReports;
|
|
151
141
|
|
|
152
142
|
if (shouldCleanReports) {
|
|
153
143
|
const reportsDir = path.join(projectRoot, "reports");
|
|
@@ -158,14 +148,10 @@ program
|
|
|
158
148
|
}
|
|
159
149
|
|
|
160
150
|
// Now spawn the process
|
|
161
|
-
const cucumberProcess = spawn(
|
|
162
|
-
"
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
stdio: "inherit",
|
|
166
|
-
env: { ...process.env, ...extraEnv },
|
|
167
|
-
}
|
|
168
|
-
);
|
|
151
|
+
const cucumberProcess = spawn("npx", ["cucumber-js", ...cliParts], {
|
|
152
|
+
stdio: "inherit",
|
|
153
|
+
env: { ...process.env, ...extraEnv },
|
|
154
|
+
});
|
|
169
155
|
|
|
170
156
|
cucumberProcess.on("close", async (code) => {
|
|
171
157
|
if (code === 0) {
|