Skip to content

Cyp 667 #241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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