Skip to content

Commit ee87175

Browse files
committed
added max duration in cli
1 parent 33d1935 commit ee87175

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

commands/utils/set_args.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,10 @@ function sync_args_from_cmd(args) {
434434
lt_config["run_settings"]["npm_via_tunnel"] = false;
435435
}
436436

437+
if ("max_duration" in args) {
438+
lt_config["run_settings"]["max_duration"] = parseFloat(args["max_duration"]);
439+
}
440+
437441
//get specs from current directory if specs are not passed in config or cli
438442
if (
439443
(lt_config["run_settings"]["specs"] == undefined ||

commands/utils/validate.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,18 @@ module.exports = validate_config = function (lt_config, validation_configs) {
5151
reject("Error!! Parallels value not correct");
5252
}
5353

54+
//validate max duration
55+
if ("max_duration" in lt_config["run_settings"]){
56+
let max_duration = lt_config["run_settings"]["max_duration"];
57+
if (!(max_duration == undefined ||
58+
max_duration == null ||
59+
isNaN(max_duration))) {
60+
if (parseFloat(max_duration) <2 || parseFloat(max_duration) > 240){
61+
reject("Error!! max_duration should be between 2 and 240 minutes");
62+
}
63+
}
64+
}
65+
5466
//Validate if package.json is having the cypress dependency
5567
var cypress_version;
5668
if (!fs.existsSync("package.json")) {

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ const argv = require("yargs")
187187
alias: "npm_via_tunnel",
188188
describe: "Install npm packages which are behind private VPN. Disclaimer:This will increase the build duration of your tests.",
189189
type: "bool",
190+
})
191+
.option("md", {
192+
alias: "max_duration",
193+
describe: "stops test if it is running more than max_duration minutes.",
194+
type: "string",
190195
});
191196
},
192197
function (argv) {

0 commit comments

Comments
 (0)