From bef58f561dbf8162224cf2303dcf1be0548e21c8 Mon Sep 17 00:00:00 2001 From: Himanshu Ranjan Date: Sun, 19 Nov 2023 20:00:28 +0530 Subject: [PATCH 1/4] correct logic for cypress settings --- commands/utils/utils.js | 27 +++++++++++++++++++++++++++ commands/utils/validate.js | 9 +++++---- 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 commands/utils/utils.js diff --git a/commands/utils/utils.js b/commands/utils/utils.js new file mode 100644 index 0000000..f648403 --- /dev/null +++ b/commands/utils/utils.js @@ -0,0 +1,27 @@ +function split_at_pattern(s, pattern) { + const res = []; + let beg = 0; + let inString = false; + + for (let i = 0; i < s.length; i++) { + if (s[i] === pattern && !inString) { + res.push(s.substring(beg, i)); + beg = i + 1; + } else if (s[i] === '"') { + if (!inString) { + inString = true; + } else if (i > 0 && s[i - 1] !== '\\') { + inString = false; + } + } + } + + res.push(s.substring(beg)); + return res; +} + + +module.exports = { + split_at_pattern: split_at_pattern, + }; + \ No newline at end of file diff --git a/commands/utils/validate.js b/commands/utils/validate.js index 0ae774f..f796664 100644 --- a/commands/utils/validate.js +++ b/commands/utils/validate.js @@ -1,6 +1,7 @@ const fs = require("fs"); const semver = require("semver"); const semverCompare = require("semver/functions/compare"); +const { split_at_pattern } = require("./utils.js"); const constants = require("./constants.js"); module.exports = validate_config = function (lt_config, validation_configs) { @@ -208,18 +209,18 @@ module.exports = validate_config = function (lt_config, validation_configs) { validation_configs.blacklistCommands[i] ); } - let settings = lt_config["run_settings"]["cypress_settings"].split(";"); - //let setting_names = []; + let settings = split_at_pattern(lt_config["run_settings"]["cypress_settings"], ';') let settings_flag = true; let setting_param = ""; for (let i = 0; i < settings.length; i++) { + let configs = split_at_pattern(settings[i],' ') if ( validation_configs.blacklistCommands.some((rx) => - rx.test(settings[i].split(" ")[0]) + rx.test(configs[0]) ) ) { settings_flag = false; - setting_param = settings[i].split(" ")[0]; + setting_param = configs[0]; break; } } From aa13e01abd0599a3d9d2738e03b5476af6a63fd7 Mon Sep 17 00:00:00 2001 From: Himanshu Ranjan Date: Mon, 20 Nov 2023 12:07:24 +0530 Subject: [PATCH 2/4] bump version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2ccc59a..f2bb82e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lambdatest-cypress-cli", - "version": "3.0.21", + "version": "3.0.22", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "lambdatest-cypress-cli", - "version": "3.0.21", + "version": "3.0.22", "license": "MIT", "dependencies": { "@lambdatest/node-tunnel": "latest", diff --git a/package.json b/package.json index 8fd3a37..dafbca5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lambdatest-cypress-cli", - "version": "3.0.21", + "version": "3.0.22", "description": "The lambdatest-cypress-cli is LambdaTest's command-line interface (CLI) aimed to help you run your Cypress tests on LambdaTest platform.", "homepage": "https://github.com/LambdaTest/lambdatest-cypress-cli", "author": "LambdaTest ", From b256c0a83d05e751cc9d1d84bd490a4f3387d65d Mon Sep 17 00:00:00 2001 From: Himanshu Ranjan Date: Wed, 29 Nov 2023 18:55:13 +0530 Subject: [PATCH 3/4] added full har cap --- commands/utils/set_args.js | 8 ++++++++ index.js | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/commands/utils/set_args.js b/commands/utils/set_args.js index b81a9c2..65fb164 100644 --- a/commands/utils/set_args.js +++ b/commands/utils/set_args.js @@ -489,6 +489,14 @@ function sync_args_from_cmd(args) { lt_config["run_settings"]["exclude_specs"] == []; } + if ("fullHar" in args) { + if (args["fullHar"] == "true") { + lt_config.run_settings.fullHar = true; + } else { + lt_config.run_settings.fullHar = false; + } + } + if ("npm-f" in args) { if (args["npm-f"] == "true") { lt_config.run_settings.npmf = true; diff --git a/index.js b/index.js index 5a2f851..849a240 100644 --- a/index.js +++ b/index.js @@ -122,6 +122,11 @@ const argv = require("yargs") describe: "Capture Network logs", type: "string", }) + .option("fullHar", { + alias: "fullHar", + describe: "Capture Full Har Network logs", + type: "bool", + }) .option("eof", { alias: "exit-on-failure", describe: "Exit With Code 1 on failure", From 846589d3a3a7f89c05d7ff08ba1cb3cd7f395fd0 Mon Sep 17 00:00:00 2001 From: Himanshu Ranjan <106653965+HRanjan-11@users.noreply.github.com> Date: Fri, 1 Dec 2023 10:20:50 +0530 Subject: [PATCH 4/4] Revert "added full har cap" --- commands/utils/set_args.js | 8 -------- index.js | 5 ----- 2 files changed, 13 deletions(-) diff --git a/commands/utils/set_args.js b/commands/utils/set_args.js index 65fb164..b81a9c2 100644 --- a/commands/utils/set_args.js +++ b/commands/utils/set_args.js @@ -489,14 +489,6 @@ function sync_args_from_cmd(args) { lt_config["run_settings"]["exclude_specs"] == []; } - if ("fullHar" in args) { - if (args["fullHar"] == "true") { - lt_config.run_settings.fullHar = true; - } else { - lt_config.run_settings.fullHar = false; - } - } - if ("npm-f" in args) { if (args["npm-f"] == "true") { lt_config.run_settings.npmf = true; diff --git a/index.js b/index.js index 849a240..5a2f851 100644 --- a/index.js +++ b/index.js @@ -122,11 +122,6 @@ const argv = require("yargs") describe: "Capture Network logs", type: "string", }) - .option("fullHar", { - alias: "fullHar", - describe: "Capture Full Har Network logs", - type: "bool", - }) .option("eof", { alias: "exit-on-failure", describe: "Exit With Code 1 on failure",