@gatling.io/cli 3.11.4-M1 → 3.11.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/package.json +1 -1
- package/target/dependencies/versions.js +2 -2
- package/target/index.js +19 -7
package/package.json
CHANGED
package/target/index.js
CHANGED
|
@@ -35,8 +35,20 @@ const simulationWithDefaults = (options, simulationsFound) => {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
const simulationRequiredOption = new commander_1.Option("--simulation <value>", "The simulation entry point function name").makeOptionMandatory(true);
|
|
38
|
-
const bundleFileOption = new commander_1.Option("--bundle-file <value>", "The target bundle file path when building simulations").default("target/bundle.js");
|
|
39
|
-
const
|
|
38
|
+
const bundleFileOption = new commander_1.Option("--bundle-file <value>", "The target bundle file path when building simulations (must have a .js extension)").default("target/bundle.js");
|
|
39
|
+
const validateBundleFile = (options) => {
|
|
40
|
+
if (!options.bundleFile.endsWith(".js")) {
|
|
41
|
+
throw Error(`'${options.bundleFile}' is not a valid bundle file path: should have a .js extension`);
|
|
42
|
+
}
|
|
43
|
+
return options.bundleFile;
|
|
44
|
+
};
|
|
45
|
+
const enterprisePackageFileOption = new commander_1.Option("--enterprise-package-file <value>", "The target package file path when packaging simulations for Gatling Enterprise (must have a .zip extension)").default("target/package.zip");
|
|
46
|
+
const validateEnterprisePackageFile = (options) => {
|
|
47
|
+
if (!options.enterprisePackageFile.endsWith(".zip")) {
|
|
48
|
+
throw Error(`'${options.enterprisePackageFile}' is not a valid package file path: should have a .zip extension`);
|
|
49
|
+
}
|
|
50
|
+
return options.enterprisePackageFile;
|
|
51
|
+
};
|
|
40
52
|
const resourcesFolderOption = new commander_1.Option("--resources-folder <value>", "The resources folder path").default("resources");
|
|
41
53
|
const resultsFolderOption = new commander_1.Option("--results-folder <value>", "The results folder path").default("target/gatling");
|
|
42
54
|
const typescriptOption = new commander_1.Option("--typescript", "Use the typescript compiler to compile your code (default: true if the sourcesFolder contains any *.gatling.ts file, false otherwise)");
|
|
@@ -64,7 +76,7 @@ program
|
|
|
64
76
|
.addOption(typescriptOption)
|
|
65
77
|
.action(async (options) => {
|
|
66
78
|
const sourcesFolder = options.sourcesFolder;
|
|
67
|
-
const bundleFile = options
|
|
79
|
+
const bundleFile = validateBundleFile(options);
|
|
68
80
|
const simulations = await (0, simulations_1.findSimulations)(sourcesFolder);
|
|
69
81
|
const typescript = typescriptWithDefaults(options, simulations);
|
|
70
82
|
await (0, bundle_1.bundle)({ sourcesFolder, bundleFile, typescript, simulations });
|
|
@@ -82,7 +94,7 @@ program
|
|
|
82
94
|
const graalvmHome = options.graalvmHome;
|
|
83
95
|
const jvmClasspath = options.jvmClasspath;
|
|
84
96
|
const simulation = options.simulation;
|
|
85
|
-
const bundleFile = options
|
|
97
|
+
const bundleFile = validateBundleFile(options);
|
|
86
98
|
const resourcesFolder = options.resourcesFolder;
|
|
87
99
|
const resultsFolder = options.resultsFolder;
|
|
88
100
|
await (0, run_1.runSimulation)({
|
|
@@ -107,7 +119,7 @@ program
|
|
|
107
119
|
.action(async (options) => {
|
|
108
120
|
const gatlingHome = gatlingHomeDirWithDefaults(options);
|
|
109
121
|
const sourcesFolder = options.sourcesFolder;
|
|
110
|
-
const bundleFile = options
|
|
122
|
+
const bundleFile = validateBundleFile(options);
|
|
111
123
|
const resourcesFolder = options.resourcesFolder;
|
|
112
124
|
const resultsFolder = options.resultsFolder;
|
|
113
125
|
const simulations = await (0, simulations_1.findSimulations)(sourcesFolder);
|
|
@@ -150,8 +162,8 @@ program
|
|
|
150
162
|
.action(async (options) => {
|
|
151
163
|
const sourcesFolder = options.sourcesFolder;
|
|
152
164
|
const resourcesFolder = options.resourcesFolder;
|
|
153
|
-
const bundleFile = options
|
|
154
|
-
const enterprisePackageFile = options
|
|
165
|
+
const bundleFile = validateBundleFile(options);
|
|
166
|
+
const enterprisePackageFile = validateEnterprisePackageFile(options);
|
|
155
167
|
const simulations = await (0, simulations_1.findSimulations)(sourcesFolder);
|
|
156
168
|
const typescript = typescriptWithDefaults(options, simulations);
|
|
157
169
|
await (0, bundle_1.bundle)({ sourcesFolder, bundleFile, typescript, simulations });
|