Skip to content

Commit cdff763

Browse files
Merge pull request #212 from LambdaTest/dev
3.0.7
2 parents 7db2580 + a20a313 commit cdff763

File tree

8 files changed

+83
-28
lines changed

8 files changed

+83
-28
lines changed

commands/init.js

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,38 @@ function create_file(file_path, content) {
1212
}
1313

1414
function create_ltconfig_file(args) {
15-
let config = require('./utils/default_config.js')
16-
let content = JSON.stringify(config, null, 3);
17-
if (args._.length == 1) {
18-
create_file(constants.LT_CONFIG_NAME, content)
15+
let cv=9.6
16+
if("cv" in args){
17+
cv=args["cv"]
1918
}
20-
else if (args._.length > 1) {
19+
let config =parseInt(cv)>=10?require('./utils/default_config_10.js'):require('./utils/default_config_9.js')
20+
config.run_settings.npm_dependencies.cypress=cv.toString()
21+
let content = JSON.stringify(config, null, 3);
22+
if ("config-file-name" in args && args["config-file-name"] !=""){
2123
//check if file or directory exists
22-
if (fs.existsSync(args._[1])) {
23-
let stats = fs.statSync(args._[1]);
24+
if (fs.existsSync(args["config-file-name"])) {
25+
let stats = fs.statSync(args["config-file-name"]);
2426
if (stats.isFile()) {
25-
make_file(args._[1], content)
27+
create_file(args["config-file-name"], content)
2628
}
2729
else {
28-
create_file(path.join(args._[1], constants.LT_CONFIG_NAME), content)
30+
create_file(path.join(args["config-file-name"], constants.LT_CONFIG_NAME), content)
2931
}
3032
}
3133
else {
32-
filename = path.basename(args._[1])
34+
filename = path.basename(args["config-file-name"])
3335
var re = new RegExp(".+\\..+");
3436
if (re.test(filename)) {
35-
fs.mkdirSync(path.dirname(args._[1]), { recursive: true });
36-
create_file(args._[1], content)
37-
}
38-
else {
39-
fs.mkdirSync(args._[1], { recursive: true });
40-
create_file(path.join(args._[1], constants.LT_CONFIG_NAME), content)
37+
fs.mkdirSync(path.dirname(args["config-file-name"]), { recursive: true });
38+
create_file(args["config-file-name"], content)
39+
}else {
40+
fs.mkdirSync(args["config-file-name"], { recursive: true });
41+
create_file(path.join(args["config-file-name"], constants.LT_CONFIG_NAME), content)
4142
}
4243
}
44+
}else{
45+
console.log("Picking the default config file name ",constants.LT_CONFIG_NAME)
46+
create_file(constants.LT_CONFIG_NAME, content)
4347
}
4448
};
4549

@@ -59,13 +63,17 @@ function create_custom_support_file(args){
5963
console.log("Error while copying custom support file", err);
6064
}
6165
else {
62-
console.log("Successfully saved custom support file at - ", pathToNewDestination);
66+
console.log("Saved at ", pathToNewDestination);
6367
}
6468
});
6569
}
6670

6771
module.exports = function (args) {
6872
create_ltconfig_file(args);
6973
create_base_reporter_config_file(args);
70-
create_custom_support_file(args);
74+
if ("cv" in args){
75+
if (parseInt(args["cv"])>=10){
76+
create_custom_support_file(args);
77+
}
78+
}
7179
};

commands/utils/constants.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ module.exports = {
2727
"https://api.lambdatest.com/automation/api/v1/cypress/artefacts/test/",
2828
},
2929
beta: {
30-
INTEGRATION_BASE_URL: "https://api.cypress-v3.dev.lambdatest.io/liis",
30+
INTEGRATION_BASE_URL: "https://api-cypress-v1-dev.lambdatestinternal.com/liis",
3131
BUILD_BASE_URL:
32-
"https://api.cypress-v3.dev.lambdatest.io/automation/api/v1/builds/",
32+
"https://api-cypress-v1-dev.lambdatestinternal.com/automation/api/v1/builds/",
3333
BUILD_STOP_URL:
34-
"https://api.cypress-v3.dev.lambdatest.io/api/v1/test/stop?sessionId=",
34+
"https://api-cypress-v1-dev.lambdatestinternal.com/api/v1/test/stop?sessionId=",
3535
SESSION_URL:
36-
"https://api.cypress-v3.dev.lambdatest.io/automation/api/v1/sessions?limit=200&session_id=",
36+
"https://api-cypress-v1-dev.lambdatestinternal.com/automation/api/v1/sessions?limit=200&session_id=",
3737
REPORT_URL:
38-
"https://api.cypress-v3.dev.lambdatest.io/automation/api/v1/cypress/artefacts/test/",
38+
"https://api-cypress-v1-dev.lambdatestinternal.com/automation/api/v1/cypress/artefacts/test/",
3939
},
4040
stage: {
4141
INTEGRATION_BASE_URL: "https://stage-api.lambdatestinternal.com/liis",

commands/utils/default_config_10.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module.exports = {
2+
lambdatest_auth: {
3+
username: "<Your LambdaTest username>",
4+
access_key: "<Your LambdaTest access key>",
5+
},
6+
browsers: [
7+
{
8+
browser: "Chrome",
9+
platform: "Windows 10",
10+
versions: ["latest-1"],
11+
},
12+
{
13+
browser: "Firefox",
14+
platform: "Windows 10",
15+
versions: ["latest-1"],
16+
},
17+
],
18+
run_settings: {
19+
reporter_config_file: "base_reporter_config.json",
20+
build_name: "build-name",
21+
parallels: 1,
22+
specs: "<path_of_cypress_spec_files>",
23+
ignore_files: "",
24+
network: false,
25+
headless: false,
26+
npm_dependencies: {
27+
cypress: "10.5.0",
28+
},
29+
},
30+
tunnel_settings: {
31+
tunnel: false,
32+
tunnel_name: null,
33+
},
34+
};
File renamed without changes.

commands/utils/validate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ module.exports = validate_config = function (lt_config, validation_configs) {
148148
lt_config["run_settings"]["cypress_config_file"]
149149
) {
150150
reject(
151-
'Error!! --ccf flag and cypress_config_file is not supported with cypress>=10,use \n --cy="--config-file <file path>"'
151+
'Error!! --ccf flag, cypress_config_file, cypress.json is not supported with cypress>=10,remove cypress.json if present and use \n --cy="--config-file <file path>" For passing custom config files'
152152
);
153153
}
154154

index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@ const { init } = require("./commands/init");
44

55
const argv = require("yargs")
66
.usage("Usage: $0 <command> [options]")
7-
.command("init", "create an intial config file", {}, function (argv) {
7+
.command("init", "create an intial config file", function(yargs){
8+
return yargs
9+
.option("cv",{
10+
alias: "cypress-version",
11+
describe: "Cypress version",
12+
type: "int",
13+
})
14+
.option("f",{
15+
alias: "config-file-name",
16+
describe: "Cypress version",
17+
type: "string",
18+
})
19+
}, function (argv) {
820
require("./commands/init")(argv);
921
})
1022
.command(

package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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": "3.0.6",
3+
"version": "3.0.7",
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)