@gatling.io/cli 3.11.6 → 3.11.7
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/package.json +2 -2
- package/target/dependencies/versions.js +1 -1
- package/target/index.js +12 -12
- package/target/run.d.ts +1 -1
- package/target/run.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gatling.io/cli",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.7",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"gatling": "target/index.js"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@types/readline-sync": "1.4.8",
|
|
24
24
|
"prettier": "3.3.3",
|
|
25
25
|
"rimraf": "6.0.1",
|
|
26
|
-
"typescript": "5.5.
|
|
26
|
+
"typescript": "5.5.4"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"clean": "rimraf target",
|
package/target/index.js
CHANGED
|
@@ -77,20 +77,20 @@ const memoryOption = new commander_1.Option("--memory <value>", "Heap space memo
|
|
|
77
77
|
return parsedValue;
|
|
78
78
|
});
|
|
79
79
|
const nonInteractiveOption = new commander_1.Option("--non-interactive", "Switch to non-interactive mode and fail if no simulation is explicitly specified").default(false);
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
const
|
|
80
|
+
const runParametersArgument = new commander_1.Argument("[optionKey=optionValue...]", "Specify one or more parameter which can be read in the simulation script with the getParameter() function; format must be key=value");
|
|
81
|
+
const parseRunParameters = (args) => {
|
|
82
|
+
const parsedParameters = {};
|
|
83
83
|
for (const arg of args) {
|
|
84
84
|
const i = arg.indexOf("=");
|
|
85
85
|
if (i < 0) {
|
|
86
|
-
throw Error(`
|
|
86
|
+
throw Error(`Parameter '${arg}' is not valid: format should be key=value`);
|
|
87
87
|
}
|
|
88
88
|
else {
|
|
89
89
|
const key = arg.slice(0, i).trim();
|
|
90
|
-
|
|
90
|
+
parsedParameters[key] = arg.slice(i + 1);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
return
|
|
93
|
+
return parsedParameters;
|
|
94
94
|
};
|
|
95
95
|
program
|
|
96
96
|
.command("install")
|
|
@@ -126,7 +126,7 @@ program
|
|
|
126
126
|
.addOption(resourcesFolderOption)
|
|
127
127
|
.addOption(resultsFolderOption)
|
|
128
128
|
.addOption(memoryOption)
|
|
129
|
-
.addArgument(
|
|
129
|
+
.addArgument(runParametersArgument)
|
|
130
130
|
.action(async (args, options) => {
|
|
131
131
|
const graalvmHome = options.graalvmHome;
|
|
132
132
|
const jvmClasspath = options.jvmClasspath;
|
|
@@ -135,7 +135,7 @@ program
|
|
|
135
135
|
const resourcesFolder = options.resourcesFolder;
|
|
136
136
|
const resultsFolder = options.resultsFolder;
|
|
137
137
|
const memory = options.memory;
|
|
138
|
-
const
|
|
138
|
+
const runParameters = parseRunParameters(args);
|
|
139
139
|
await (0, run_1.runSimulation)({
|
|
140
140
|
graalvmHome,
|
|
141
141
|
jvmClasspath,
|
|
@@ -144,7 +144,7 @@ program
|
|
|
144
144
|
resourcesFolder,
|
|
145
145
|
resultsFolder,
|
|
146
146
|
memory,
|
|
147
|
-
|
|
147
|
+
runParameters
|
|
148
148
|
});
|
|
149
149
|
});
|
|
150
150
|
program
|
|
@@ -159,7 +159,7 @@ program
|
|
|
159
159
|
.addOption(gatlingHomeOption)
|
|
160
160
|
.addOption(memoryOption)
|
|
161
161
|
.addOption(nonInteractiveOption)
|
|
162
|
-
.addArgument(
|
|
162
|
+
.addArgument(runParametersArgument)
|
|
163
163
|
.action(async (args, options) => {
|
|
164
164
|
const gatlingHome = gatlingHomeDirWithDefaults(options);
|
|
165
165
|
const sourcesFolder = options.sourcesFolder;
|
|
@@ -168,7 +168,7 @@ program
|
|
|
168
168
|
const resultsFolder = options.resultsFolder;
|
|
169
169
|
const memory = options.memory;
|
|
170
170
|
const nonInteractive = options.nonInteractive;
|
|
171
|
-
const
|
|
171
|
+
const runParameters = parseRunParameters(args);
|
|
172
172
|
const simulations = await (0, simulations_1.findSimulations)(sourcesFolder);
|
|
173
173
|
const typescript = typescriptWithDefaults(options, simulations);
|
|
174
174
|
const simulation = simulationWithDefaults(options, simulations, !nonInteractive);
|
|
@@ -185,7 +185,7 @@ program
|
|
|
185
185
|
resourcesFolder,
|
|
186
186
|
resultsFolder,
|
|
187
187
|
memory,
|
|
188
|
-
|
|
188
|
+
runParameters
|
|
189
189
|
});
|
|
190
190
|
});
|
|
191
191
|
program
|
package/target/run.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface RunSimulationOptions extends RunJavaProcessOptions {
|
|
|
5
5
|
resourcesFolder: string;
|
|
6
6
|
resultsFolder: string;
|
|
7
7
|
memory?: number;
|
|
8
|
-
|
|
8
|
+
runParameters: Record<string, string>;
|
|
9
9
|
}
|
|
10
10
|
export interface RunRecorderOptions extends RunJavaProcessOptions {
|
|
11
11
|
sourcesFolder: string;
|
package/target/run.js
CHANGED
|
@@ -13,7 +13,7 @@ const runSimulation = async (options) => {
|
|
|
13
13
|
const additionalClasspathElements = [options.resourcesFolder];
|
|
14
14
|
const memoryArgs = options.memory !== undefined ? [`-Xms${options.memory}M`, `-Xmx${options.memory}M`] : [];
|
|
15
15
|
const javaArgs = [
|
|
16
|
-
...Object.entries(options.
|
|
16
|
+
...Object.entries(options.runParameters).map(([key, value]) => `-D${key}=${value}`),
|
|
17
17
|
`-Dgatling.js.bundle.filePath=${options.bundleFile}`,
|
|
18
18
|
`-Dgatling.js.simulation=${options.simulation}`,
|
|
19
19
|
...memoryArgs
|