From bc3ab7e34b058f62f6b476938320e6a2954e1f1a Mon Sep 17 00:00:00 2001 From: Japneet Singh Chawla Date: Thu, 10 Feb 2022 13:34:44 +0530 Subject: [PATCH 1/2] only .npmrc file is moved and error message for cypress depency is improved --- commands/utils/archive.js | 39 ++++++++++++++++++++------------------ commands/utils/validate.js | 6 +++++- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/commands/utils/archive.js b/commands/utils/archive.js index 5e13f27..602a63f 100644 --- a/commands/utils/archive.js +++ b/commands/utils/archive.js @@ -69,7 +69,7 @@ function archive_project(lt_config) { console.log("Ignoring files: ", ignore_files); archive.glob( "**/*", - { cwd: process.cwd(), ignore: ignore_files, dot: true }, + { cwd: process.cwd(), ignore: ignore_files, dot: false }, { prefix: "project/" } ); //OverRide NPM Dependencies @@ -90,12 +90,12 @@ function archive_project(lt_config) { { prefix: "project/" } ); } - if ( - lt_config.run_settings.dep_tokens && - lt_config.run_settings.dep_tokens.length > 0 - ) { - if (fs.existsSync(".npmrc")) { - let raw_data = fs.readFileSync(".npmrc", "utf8"); + if (fs.existsSync(".npmrc")) { + let raw_data = fs.readFileSync(".npmrc", "utf8"); + if ( + lt_config.run_settings.dep_tokens && + lt_config.run_settings.dep_tokens.length > 0 + ) { let replace_map = {}; for (let i = 0; i < lt_config.run_settings.dep_tokens.length; i++) { if (process.env[lt_config.run_settings.dep_tokens[i]]) { @@ -115,18 +115,21 @@ function archive_project(lt_config) { raw_data = raw_data.replace(re, function (matched) { return replace_map[matched]; }); - archive.append( - raw_data, - { - name: "project/.npmrc", - cwd: process.cwd(), - ignore: ignore_files, - }, - { prefix: "project/" } - ); - } else { - reject("Dep Tokens are passed but .npmrc does not exist"); } + archive.append( + raw_data, + { + name: "project/.npmrc", + cwd: process.cwd(), + ignore: ignore_files, + }, + { prefix: "project/" } + ); + } else if ( + lt_config.run_settings.dep_tokens && + lt_config.run_settings.dep_tokens.length > 0 + ) { + reject("Dep Tokens are passed but .npmrc does not exist"); } archive.finalize(); diff --git a/commands/utils/validate.js b/commands/utils/validate.js index c5f46b4..51bfb0a 100644 --- a/commands/utils/validate.js +++ b/commands/utils/validate.js @@ -106,7 +106,11 @@ module.exports = validate_config = function (lt_config) { } } } - if (cypress_flag == false) { + if (cypress_flag == false && lt_config.run_settings.npm_dependencies) { + reject( + "Error!!Cypress dependency is not present in npm_dependencies" + ); + } else if (cypress_flag == false) { reject("Error!!Cypress dependency is not present in package.json"); } } catch (e) { From fe7f718e8159cb22f30a5381211324050185c27f Mon Sep 17 00:00:00 2001 From: Japneet Singh Chawla Date: Fri, 11 Feb 2022 17:11:39 +0530 Subject: [PATCH 2/2] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cddc7f1..54e6a44 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lambdatest-cypress-cli", - "version": "2.1.8", + "version": "2.1.9", "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 ",