k6-cucumber-steps 1.0.3 → 1.0.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.
- package/bin/k6-cucumber-runner.js +7 -3
- package/libs/index.js +21 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
const fs = require("fs");
|
|
3
4
|
const path = require("path");
|
|
4
5
|
const { spawn } = require("child_process");
|
|
5
6
|
require("dotenv").config();
|
|
@@ -34,7 +35,12 @@ const cucumberArgs = [
|
|
|
34
35
|
"--require-module",
|
|
35
36
|
"@babel/register",
|
|
36
37
|
"--require",
|
|
37
|
-
path.resolve(
|
|
38
|
+
path.resolve(
|
|
39
|
+
process.cwd(),
|
|
40
|
+
"node_modules",
|
|
41
|
+
"k6-cucumber-steps",
|
|
42
|
+
"step_definitions"
|
|
43
|
+
),
|
|
38
44
|
"--format",
|
|
39
45
|
"summary",
|
|
40
46
|
];
|
|
@@ -78,5 +84,3 @@ main().catch((err) => {
|
|
|
78
84
|
console.error("An unexpected error occurred:", err.message);
|
|
79
85
|
process.exit(1);
|
|
80
86
|
});
|
|
81
|
-
|
|
82
|
-
// No need to import the @cucumber/cucumber API directly anymore
|
package/libs/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// lib/index.js (example with JavaScript)
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Registers the k6-cucumber-steps step definitions with the Cucumber runner.
|
|
6
|
+
* @param projectRootDir The absolute path to the root directory of the user's project.
|
|
7
|
+
*/
|
|
8
|
+
function registerSteps(projectRootDir) {
|
|
9
|
+
// Construct the path to your package's step definitions
|
|
10
|
+
const packageStepsPath = path.resolve(__dirname, "../step_definitions");
|
|
11
|
+
|
|
12
|
+
return [packageStepsPath];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = {
|
|
16
|
+
registerSteps,
|
|
17
|
+
buildK6Script: require("./helpers/buildK6Script"),
|
|
18
|
+
generateHeaders: require("./helpers/generateHeaders"),
|
|
19
|
+
resolveBody: require("./helpers/resolveBody"),
|
|
20
|
+
k6Runner: require("./utils/k6Runner"),
|
|
21
|
+
};
|