Skip to content

Commit 0b34b75

Browse files
Merge pull request #80 from LambdaTest/dev
Dev to Master
2 parents 89def7a + fd7f1ca commit 0b34b75

File tree

4 files changed

+124
-100
lines changed

4 files changed

+124
-100
lines changed

commands/utils/set_args.js

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

261+
//check for download folders
262+
if (!("downloads" in lt_config["run_settings"])) {
263+
lt_config["run_settings"]["downloads"] = "";
264+
}
261265
//get specs from current directory if specs are not passed in config or cli
262266
if (
263267
(lt_config["run_settings"]["specs"] == undefined ||

commands/utils/validate.js

Lines changed: 28 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,42 @@ 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 (
141+
"downloads" in lt_config["run_settings"] &&
142+
lt_config["run_settings"]["downloads"] != ""
143+
) {
144+
let download_folders = lt_config["run_settings"]["downloads"].split(",");
145+
for (folder in download_folders) {
146+
if (folder[0] != ".") {
147+
reject("Error!! dowloads folder path is not relative ", folder);
148+
}
149+
}
150+
}
129151
resolve("Validated the Config");
130152
});
131153
};

index.js

Lines changed: 91 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -11,99 +11,97 @@ const argv = require("yargs")
1111
"run",
1212
"run tests on lambdatest",
1313
function (yargs) {
14-
return (
15-
yargs
16-
.option("ccf", {
17-
alias: "cypress-config-file",
18-
describe: "path of the config file",
19-
type: "string",
20-
})
21-
.option("lcf", {
22-
alias: "lambdatest-config-file",
23-
describe: "path of the lambdatest config file",
24-
type: "string",
25-
})
26-
.option("s", {
27-
alias: "specs",
28-
describe: "path of the spec file or directory or pattern",
29-
type: "string",
30-
})
31-
.option("env", {
32-
alias: "env",
33-
describe: "environment",
34-
type: "string",
35-
})
36-
.option("bn", {
37-
alias: "build-name",
38-
describe: "build name",
39-
type: "string",
40-
})
41-
/*.option("t", {
14+
return yargs
15+
.option("ccf", {
16+
alias: "cypress-config-file",
17+
describe: "path of the config file",
18+
type: "string",
19+
})
20+
.option("lcf", {
21+
alias: "lambdatest-config-file",
22+
describe: "path of the lambdatest config file",
23+
type: "string",
24+
})
25+
.option("s", {
26+
alias: "specs",
27+
describe: "path of the spec file or directory or pattern",
28+
type: "string",
29+
})
30+
.option("env", {
31+
alias: "environment",
32+
describe: "environment",
33+
type: "string",
34+
})
35+
.option("bn", {
36+
alias: "build-name",
37+
describe: "build name",
38+
type: "string",
39+
})
40+
.option("t", {
4241
alias: "tags",
4342
describe: "build tags",
4443
type: "string",
45-
})*/
46-
.option("p", {
47-
alias: "parallels",
48-
describe: "no of parellel sessions",
49-
type: "string",
50-
})
51-
.option("envs", {
52-
alias: "envs",
53-
describe: "environment variables",
54-
type: "string",
55-
})
56-
.option("tun", {
57-
alias: "tunnel",
58-
describe: "tunnel",
59-
type: "string",
60-
})
61-
.option("tname", {
62-
alias: "tunnel_name",
63-
describe: "tunnel name",
64-
type: "string",
65-
})
66-
.option("brs", {
67-
alias: "browsers",
68-
describe: "browsers to run test format: platform:browser:version",
69-
type: "string",
70-
})
71-
.option("bi", {
72-
alias: "build-identifier",
73-
describe: "Build Identifier / Build Counter",
74-
type: "string",
75-
})
76-
.option("if", {
77-
alias: "ignore_files",
78-
describe: "Files to ignore in the project zip",
79-
type: "string",
80-
})
81-
.option("sync", {
82-
alias: "sync",
83-
describe: "Sync Build",
84-
type: "string",
85-
})
86-
.option("autostart", {
87-
alias: "tat",
88-
describe: "Tunnel Auto Start",
89-
type: "string",
90-
})
91-
.option("headless", {
92-
alias: "headless",
93-
describe: "Run in headless mode",
94-
type: "boolean",
95-
})
96-
.option("net", {
97-
alias: "network",
98-
describe: "Capture Network logs",
99-
type: "string",
100-
})
101-
.option("eof", {
102-
alias: "exit-on-failure",
103-
describe: "Exit With Code 1 on failure",
104-
type: "string",
105-
})
106-
);
44+
})
45+
.option("p", {
46+
alias: "parallels",
47+
describe: "no of parellel sessions",
48+
type: "string",
49+
})
50+
.option("envs", {
51+
alias: "env-variables",
52+
describe: "environment variables",
53+
type: "string",
54+
})
55+
.option("tun", {
56+
alias: "tunnel",
57+
describe: "tunnel",
58+
type: "string",
59+
})
60+
.option("tname", {
61+
alias: "tunnel_name",
62+
describe: "tunnel name",
63+
type: "string",
64+
})
65+
.option("brs", {
66+
alias: "browsers",
67+
describe: "browsers to run test format: platform:browser:version",
68+
type: "string",
69+
})
70+
.option("bi", {
71+
alias: "build-identifier",
72+
describe: "Build Identifier / Build Counter",
73+
type: "string",
74+
})
75+
.option("if", {
76+
alias: "ignore_files",
77+
describe: "Files to ignore in the project zip",
78+
type: "string",
79+
})
80+
.option("sync", {
81+
alias: "sync-mode",
82+
describe: "Sync Build",
83+
type: "string",
84+
})
85+
.option("autostart", {
86+
alias: "tat",
87+
describe: "Tunnel Auto Start",
88+
type: "string",
89+
})
90+
.option("headless", {
91+
alias: "headless-mode",
92+
describe: "Run in headless mode",
93+
type: "boolean",
94+
})
95+
.option("net", {
96+
alias: "network",
97+
describe: "Capture Network logs",
98+
type: "string",
99+
})
100+
.option("eof", {
101+
alias: "exit-on-failure",
102+
describe: "Exit With Code 1 on failure",
103+
type: "string",
104+
});
107105
},
108106
function (argv) {
109107
require("./commands/run")(argv);
@@ -121,17 +119,17 @@ const argv = require("yargs")
121119
demandOption: true,
122120
})
123121
.option("user", {
124-
alias: "user",
122+
alias: "username",
125123
describe: "username",
126124
type: "string",
127125
})
128-
.option("access_key", {
126+
.option("ak", {
129127
alias: "access_key",
130128
describe: "Access Key",
131129
type: "string",
132130
})
133131
.option("env", {
134-
alias: "env",
132+
alias: "environment",
135133
describe: "environment",
136134
type: "string",
137135
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lambdatest-cypress-cli",
3-
"version": "2.1.3",
3+
"version": "2.1.4",
44
"description": "The lambdatest-cypress-cli is LambdaTest's command-line interface (CLI) aimed to help you run your Cypress tests on LambdaTest platform.",
55
"homepage": "https://github.com/LambdaTest/lambdatest-cypress-cli",
66
"author": "LambdaTest <[email protected]>",

0 commit comments

Comments
 (0)