Skip to content

Commit ee34c3f

Browse files
authored
Merge pull request #244 from LambdaTest/dev
stage to prod promote
2 parents b70b681 + 85ad1cf commit ee34c3f

File tree

5 files changed

+956
-641
lines changed

5 files changed

+956
-641
lines changed

commands/utils/set_args.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,14 @@ 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+
} else {
440+
lt_config["run_settings"]["max_duration"] = parseFloat(
441+
lt_config["run_settings"]["max_duration"]
442+
);
443+
}
444+
437445
//get specs from current directory if specs are not passed in config or cli
438446
if (
439447
(lt_config["run_settings"]["specs"] == undefined ||

commands/utils/validate.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ 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 (Number(max_duration) && Number(max_duration) % 1 !== 0){
61+
reject("Error!! max_duration should be an Integer between 2 and 240 minutes");
62+
}else if (parseInt(max_duration) <2 || parseInt(max_duration) > 240){
63+
reject("Error!! max_duration should be between 2 and 240 minutes");
64+
}
65+
}
66+
}
67+
5468
//Validate if package.json is having the cypress dependency
5569
var cypress_version;
5670
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)