Skip to content

Commit 3033035

Browse files
Japneet Singh ChawlaJapneet Singh Chawla
authored andcommitted
downloads param added in run settings
1 parent 750d385 commit 3033035

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

commands/utils/set_args.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,10 @@ function sync_args_from_cmd(args) {
264264
lt_config["run_settings"]["headless"] = false;
265265
}
266266

267+
//check for download folders
268+
if (!("downloads" in lt_config["run_settings"])) {
269+
lt_config["run_settings"]["downloads"] = "";
270+
}
267271
//get specs from current directory if specs are not passed in config or cli
268272
if (
269273
(lt_config["run_settings"]["specs"] == undefined ||

commands/utils/validate.js

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,21 @@ module.exports = validate_config = function (lt_config) {
1919
) {
2020
reject("Error!!! Auth details not correct");
2121
}
22+
2223
//Validate spec file
2324
if (!("specs" in lt_config["run_settings"])) {
2425
reject("Error!! please provide specs key");
2526
} else if (lt_config["run_settings"]["specs"].length == 0) {
2627
reject("Error!! Please provide specs, specs list can not be empty");
2728
}
29+
2830
//validate if browsers are not empty
2931
if (!("browsers" in lt_config)) {
3032
reject("Error!! please provide browsers");
3133
} else if (lt_config["browsers"].length == 0) {
3234
reject("Error!! please provide browsers, browsers list can not be empty");
3335
}
36+
3437
//validate parellel session
3538
let parallels = lt_config["run_settings"]["parallels"];
3639
if (
@@ -109,23 +112,39 @@ module.exports = validate_config = function (lt_config) {
109112
reject("Error!! Package.json File does not has correct json");
110113
}
111114
}
115+
112116
if (
113117
lt_config["run_settings"]["ignore_files"] &&
114118
lt_config["run_settings"]["ignore_files"].length > 0
115-
){
116-
for(var i=0;i<lt_config["run_settings"]["ignore_files"].length;i++){
117-
if (lt_config["run_settings"]["ignore_files"][i]=="package.json"){
118-
reject("package.json is added to ignore_files in run settings, Please remove package.json from ignore_files parameter in lambdatest-config.json file")
119-
break
119+
) {
120+
for (
121+
var i = 0;
122+
i < lt_config["run_settings"]["ignore_files"].length;
123+
i++
124+
) {
125+
if (lt_config["run_settings"]["ignore_files"][i] == "package.json") {
126+
reject(
127+
"package.json is added to ignore_files in run settings, Please remove package.json from ignore_files parameter in lambdatest-config.json file"
128+
);
129+
break;
120130
}
121131
}
122132
}
123133
//validate if network field contains expected value
124134
if ("network" in lt_config["run_settings"]) {
125-
if (!([true, false].includes(lt_config["run_settings"]["network"]))){
135+
if (![true, false].includes(lt_config["run_settings"]["network"])) {
126136
reject("Error!! boolean value is expected in network key");
127137
}
128138
}
139+
140+
if ("downloads" in lt_config["run_settings"]) {
141+
let download_folders = lt_config["run_settings"]["downloads"].split(",");
142+
for (folder in download_folders) {
143+
if (folder[0] != ".") {
144+
reject("Error!! dowloads folder path is not relative ", folder);
145+
}
146+
}
147+
}
129148
resolve("Validated the Config");
130149
});
131150
};

0 commit comments

Comments
 (0)