Skip to content

Commit

Permalink
Merge pull request #244 from LambdaTest/dev
Browse files Browse the repository at this point in the history
stage to prod promote
  • Loading branch information
asad9711 authored Apr 28, 2023
2 parents b70b681 + 85ad1cf commit ee34c3f
Show file tree
Hide file tree
Showing 5 changed files with 956 additions and 641 deletions.
8 changes: 8 additions & 0 deletions commands/utils/set_args.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,14 @@ function sync_args_from_cmd(args) {
lt_config["run_settings"]["npm_via_tunnel"] = false;
}

if ("max_duration" in args) {
lt_config["run_settings"]["max_duration"] = parseFloat(args["max_duration"]);
} else {
lt_config["run_settings"]["max_duration"] = parseFloat(
lt_config["run_settings"]["max_duration"]
);
}

//get specs from current directory if specs are not passed in config or cli
if (
(lt_config["run_settings"]["specs"] == undefined ||
Expand Down
14 changes: 14 additions & 0 deletions commands/utils/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ module.exports = validate_config = function (lt_config, validation_configs) {
reject("Error!! Parallels value not correct");
}

//validate max duration
if ("max_duration" in lt_config["run_settings"]){
let max_duration = lt_config["run_settings"]["max_duration"];
if (!(max_duration == undefined ||
max_duration == null ||
isNaN(max_duration))) {
if (Number(max_duration) && Number(max_duration) % 1 !== 0){
reject("Error!! max_duration should be an Integer between 2 and 240 minutes");
}else if (parseInt(max_duration) <2 || parseInt(max_duration) > 240){
reject("Error!! max_duration should be between 2 and 240 minutes");
}
}
}

//Validate if package.json is having the cypress dependency
var cypress_version;
if (!fs.existsSync("package.json")) {
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ const argv = require("yargs")
alias: "npm_via_tunnel",
describe: "Install npm packages which are behind private VPN. Disclaimer:This will increase the build duration of your tests.",
type: "bool",
})
.option("md", {
alias: "max_duration",
describe: "stops test if it is running more than max_duration minutes.",
type: "string",
});
},
function (argv) {
Expand Down
Loading

0 comments on commit ee34c3f

Please sign in to comment.