UNPKG

@gatling.io/cli

Version:

Gatling JS is a JavaScript/TypeScript interface for the [Gatling load testing tool](https://gatling.io/).

67 lines (66 loc) 3.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const options_1 = require("./options"); const simulations_1 = require("../simulations"); const dependencies_1 = require("../dependencies"); const log_1 = require("../log"); const bundle_1 = require("../bundle"); const run_1 = require("../run"); exports.default = (program) => { program .command("run") .description("Build and run a Gatling simulation, after installing all required components and dependencies for Gatling") .addOption(options_1.sourcesFolderOption) .addOption(options_1.protoFolderOption) .addOption(options_1.simulationOption) .addOption(options_1.typescriptOption) .addOption(options_1.bundleFileOption) .addOption(options_1.protoTargetFolderOption) .addOption(options_1.resourcesFolderOption) .addOption(options_1.resultsFolderOption) .addOption(options_1.gatlingHomeOption) .addOption(options_1.memoryOption) .addOption(options_1.postmanOption) .addOption(options_1.nonInteractiveOption) .addArgument(options_1.runParametersArgument) .action(async (args, options) => { const gatlingHome = (0, options_1.gatlingHomeOptionValueWithDefaults)(options); const sourcesFolder = (0, options_1.sourcesFolderOptionValue)(options); const protoFolder = (0, options_1.protoFolderOptionValue)(options); const bundleFile = (0, options_1.bundleFileOptionValue)(options); const protoTargetFolder = (0, options_1.protoTargetFolderOptionValue)(options); const resourcesFolder = (0, options_1.resourcesFolderOptionValue)(options); const resultsFolder = (0, options_1.resultsFolderOptionValue)(options); const memory = (0, options_1.memoryOptionValue)(options); const nonInteractive = (0, options_1.nonInteractiveOptionValue)(options); const postman = (0, options_1.postmanOptionValueWithDefaults)(options); const runParameters = (0, options_1.parseRunParametersArgument)(args); const simulations = await (0, simulations_1.findSimulations)(sourcesFolder); const typescript = (0, options_1.typescriptOptionValueWithDefaults)(options, simulations); const simulation = (0, options_1.simulationOptionValueWithDefaults)(options, simulations, !nonInteractive); const { graalvmHome, jvmClasspath, protocPath } = await (0, dependencies_1.resolveBundle)({ gatlingHome }); log_1.logger.debug(`graalvmHome=${graalvmHome}`); log_1.logger.debug(`jvmClasspath=${jvmClasspath}`); await (0, bundle_1.bundle)({ sourcesFolder, protoFolder, bundleFile, protoTargetFolder, postman, typescript, simulations, protocPath }); await (0, run_1.runSimulation)({ graalvmHome, jvmClasspath, simulation, bundleFile, resourcesFolder, protoTargetFolder, resultsFolder, memory, runParameters }); }); };