k6-cucumber-steps 1.0.11 → 1.0.12
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-runner.js +45 -36
- package/package.json +2 -2
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const path = require("path");
|
|
4
|
-
const {
|
|
4
|
+
const { spawn } = require("child_process");
|
|
5
5
|
require("dotenv").config();
|
|
6
|
-
|
|
7
6
|
const argv = require("yargs")
|
|
8
7
|
.usage("Usage: $0 run --feature <path> [options]")
|
|
9
8
|
.option("feature", {
|
|
@@ -12,46 +11,56 @@ const argv = require("yargs")
|
|
|
12
11
|
type: "string",
|
|
13
12
|
demandOption: true,
|
|
14
13
|
})
|
|
14
|
+
.option("tags", { alias: "t", describe: "Cucumber tags", type: "string" })
|
|
15
|
+
.option("reporter", {
|
|
16
|
+
alias: "r",
|
|
17
|
+
describe: "Generate reports",
|
|
18
|
+
type: "boolean",
|
|
19
|
+
default: false,
|
|
20
|
+
})
|
|
15
21
|
.help().argv;
|
|
16
22
|
|
|
17
23
|
const featureFilePath = path.resolve(process.cwd(), argv.feature);
|
|
24
|
+
const cucumberCommand = "npx";
|
|
25
|
+
const cucumberArgs = [
|
|
26
|
+
"cucumber-js",
|
|
27
|
+
featureFilePath,
|
|
28
|
+
"--require-module",
|
|
29
|
+
"@babel/register",
|
|
30
|
+
"--require",
|
|
31
|
+
path.resolve(
|
|
32
|
+
process.cwd(),
|
|
33
|
+
"node_modules",
|
|
34
|
+
"k6-cucumber-steps",
|
|
35
|
+
"step_definitions"
|
|
36
|
+
),
|
|
37
|
+
"--format",
|
|
38
|
+
"summary",
|
|
39
|
+
];
|
|
18
40
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
41
|
+
if (argv.tags) cucumberArgs.push("--tags", argv.tags);
|
|
42
|
+
if (argv.reporter) {
|
|
43
|
+
const reportsDir = path.resolve(process.cwd(), "reports");
|
|
44
|
+
cucumberArgs.push(
|
|
45
|
+
"--format",
|
|
46
|
+
`json:${reportsDir}/load-results.json`,
|
|
47
|
+
"--format",
|
|
48
|
+
`html:${reportsDir}/load-results.html`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
22
51
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"cucumber-js",
|
|
27
|
-
"--require-module",
|
|
28
|
-
"@babel/register",
|
|
29
|
-
"--require",
|
|
30
|
-
path.resolve(
|
|
31
|
-
process.cwd(),
|
|
32
|
-
"node_modules",
|
|
33
|
-
"k6-cucumber-steps",
|
|
34
|
-
"step_definitions"
|
|
35
|
-
),
|
|
36
|
-
],
|
|
37
|
-
cwd: process.cwd(),
|
|
38
|
-
featurePaths: [featureFilePath],
|
|
39
|
-
format: ["summary"],
|
|
40
|
-
});
|
|
52
|
+
async function main() {
|
|
53
|
+
const fullCommand = `${cucumberCommand} ${cucumberArgs.join(" ")}`;
|
|
54
|
+
console.log(`Running Cucumber using command: ${fullCommand}`);
|
|
41
55
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
56
|
+
const cucumberProcess = spawn(cucumberCommand, cucumberArgs, {
|
|
57
|
+
cwd: process.cwd(),
|
|
58
|
+
stdio: "inherit",
|
|
59
|
+
});
|
|
46
60
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
61
|
+
cucumberProcess.on("close", (code) => {
|
|
62
|
+
process.exit(code);
|
|
63
|
+
});
|
|
52
64
|
}
|
|
53
65
|
|
|
54
|
-
main().catch((err) =>
|
|
55
|
-
console.error("An unexpected error occurred:", err);
|
|
56
|
-
process.exit(1);
|
|
57
|
-
});
|
|
66
|
+
main().catch((err) => console.error(err));
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "k6-cucumber-steps",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"main": "index.js",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"repository": {
|
|
6
7
|
"type": "git",
|
|
7
8
|
"url": "https://github.com/qaPaschalE/k6-cucumber-steps.git"
|
|
@@ -43,7 +44,6 @@
|
|
|
43
44
|
"node": ">=18"
|
|
44
45
|
},
|
|
45
46
|
"author": "qaPaschalE",
|
|
46
|
-
"license": "ISC",
|
|
47
47
|
"description": "Cucumber step definitions for running k6 performance tests.",
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@babel/cli": "^7.27.0",
|