From 5d9995a40896a4dfcd2eac98b96e2e2fe36e6abe Mon Sep 17 00:00:00 2001 From: shreyanshc Date: Mon, 18 Aug 2025 20:45:05 +0530 Subject: [PATCH 1/2] add debugging logs --- package.json | 2 +- src/commander/ping.ts | 3 ++- src/commander/pingTest.ts | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7b03a36..125f0e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lambdatest/smartui-cli", - "version": "4.1.23", + "version": "4.1.24", "description": "A command line interface (CLI) to run SmartUI tests on LambdaTest", "files": [ "dist/**/*" diff --git a/src/commander/ping.ts b/src/commander/ping.ts index 6253627..8e0a56d 100644 --- a/src/commander/ping.ts +++ b/src/commander/ping.ts @@ -34,7 +34,8 @@ command console.error(chalk.red('Error: SmartUI server did not respond in 15 seconds')); } else { console.error(chalk.red('SmartUI server is not running')); - console.error(chalk.red(`Error: ${error.message}`)); + console.error(chalk.red(`Error: ${error?.code}`)); + console.error(error); } } }); diff --git a/src/commander/pingTest.ts b/src/commander/pingTest.ts index a1aa563..8885be7 100644 --- a/src/commander/pingTest.ts +++ b/src/commander/pingTest.ts @@ -37,6 +37,7 @@ function makeHttpRequest(url: string, timeout: number): Promise<{ status: number }); req.on('error', (error) => { + console.log(error) reject(error); }); @@ -65,6 +66,8 @@ command // Send GET request to the /ping endpoint const response = await makeHttpRequest(`${serverAddress}/ping`, 15000); + console.log("hello : "+ response) + // Log the response from the server if (response.status === 200) { console.log(chalk.green('SmartUI Server is running')); @@ -78,6 +81,8 @@ command console.error(chalk.red('Error: SmartUI server did not respond in 15 seconds')); } else { console.error(chalk.red('SmartUI server is not running')); + console.error(chalk.red(`Error: ${error?.code}`)); + console.error(error); } } }); From 08224c2ffe546c00445179be6f690dc836a79ce8 Mon Sep 17 00:00:00 2001 From: shreyanshc Date: Mon, 18 Aug 2025 20:48:00 +0530 Subject: [PATCH 2/2] fix review comments --- src/commander/pingTest.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/commander/pingTest.ts b/src/commander/pingTest.ts index 8885be7..c777a98 100644 --- a/src/commander/pingTest.ts +++ b/src/commander/pingTest.ts @@ -37,7 +37,7 @@ function makeHttpRequest(url: string, timeout: number): Promise<{ status: number }); req.on('error', (error) => { - console.log(error) + console.error(error) reject(error); }); @@ -66,8 +66,6 @@ command // Send GET request to the /ping endpoint const response = await makeHttpRequest(`${serverAddress}/ping`, 15000); - console.log("hello : "+ response) - // Log the response from the server if (response.status === 200) { console.log(chalk.green('SmartUI Server is running'));