From d5151c506085e28e28bc40c8e6202659c8c571f5 Mon Sep 17 00:00:00 2001 From: hkobew Date: Wed, 6 Nov 2024 18:14:03 -0500 Subject: [PATCH] fix test cases that inspect the logs --- .../awsService/appBuilder/explorer/nodes/deployedNode.ts | 2 +- .../src/test/awsService/appBuilder/samProject.test.ts | 2 +- .../src/test/lambda/vue/remoteInvoke/invokeLambda.test.ts | 2 +- .../core/src/test/lambda/vue/samInvokeBackend.test.ts | 2 +- .../explorer/nodes/deployedNode.test.ts | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/core/src/awsService/appBuilder/explorer/nodes/deployedNode.ts b/packages/core/src/awsService/appBuilder/explorer/nodes/deployedNode.ts index 8af4d84797d..913cdd067e0 100644 --- a/packages/core/src/awsService/appBuilder/explorer/nodes/deployedNode.ts +++ b/packages/core/src/awsService/appBuilder/explorer/nodes/deployedNode.ts @@ -96,7 +96,7 @@ export async function generateDeployedNode( .Configuration as Lambda.FunctionConfiguration newDeployedResource = new LambdaFunctionNode(lambdaNode, regionCode, configuration) } catch (error: any) { - getLogger().error('Error getting Lambda configuration') + getLogger().error('Error getting Lambda configuration %O', error) throw ToolkitError.chain(error, 'Error getting Lambda configuration', { code: 'lambdaClientError', }) diff --git a/packages/core/src/test/awsService/appBuilder/samProject.test.ts b/packages/core/src/test/awsService/appBuilder/samProject.test.ts index 1b60c06e0ae..1d884ddd694 100644 --- a/packages/core/src/test/awsService/appBuilder/samProject.test.ts +++ b/packages/core/src/test/awsService/appBuilder/samProject.test.ts @@ -78,7 +78,7 @@ describe('samProject', () => { // simulate error when no samconfig.toml file in directory const result = await getStackName(projectRoot) assert.deepStrictEqual(result, {}) - assertLogsContain('No stack name or region information available in samconfig.toml', true, 'info') + assertLogsContain('No stack name or region information available in samconfig.toml: %O', true, 'info') }) it('returns empty object give error parsing samconfig file', async () => { diff --git a/packages/core/src/test/lambda/vue/remoteInvoke/invokeLambda.test.ts b/packages/core/src/test/lambda/vue/remoteInvoke/invokeLambda.test.ts index 823472bfb68..5878dca3bad 100644 --- a/packages/core/src/test/lambda/vue/remoteInvoke/invokeLambda.test.ts +++ b/packages/core/src/test/lambda/vue/remoteInvoke/invokeLambda.test.ts @@ -198,7 +198,7 @@ describe('RemoteInvokeWebview', () => { new Error('Failed to read selected file') ) assert.strictEqual(loggerErrorStub.calledOnce, true) - assert.strictEqual(loggerErrorStub.firstCall.args[0], 'readFileSync: Failed to read file at path %O') + assert.strictEqual(loggerErrorStub.firstCall.args[0], 'readFileSync: Failed to read file at path %s %O') assert.strictEqual(loggerErrorStub.firstCall.args[1], fileUri.fsPath) assert(loggerErrorStub.firstCall.args[2] instanceof Error) } finally { diff --git a/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts b/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts index 8f3eeff2e21..25b3d1eac8f 100644 --- a/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts +++ b/packages/core/src/test/lambda/vue/samInvokeBackend.test.ts @@ -446,7 +446,7 @@ describe('SamInvokeWebview', () => { new Error('Failed to read selected file') ) assert.strictEqual(loggerErrorStub.calledOnce, true) - assert.strictEqual(loggerErrorStub.firstCall.args[0], 'readFileSync: Failed to read file at path %O') + assert.strictEqual(loggerErrorStub.firstCall.args[0], 'readFileSync: Failed to read file at path %s %O') assert.strictEqual(loggerErrorStub.firstCall.args[1], fileUri.fsPath) assert(loggerErrorStub.firstCall.args[2] instanceof Error) } finally { diff --git a/packages/core/src/test/shared/applicationBuilder/explorer/nodes/deployedNode.test.ts b/packages/core/src/test/shared/applicationBuilder/explorer/nodes/deployedNode.test.ts index 8579d90fdbb..07e7ea04bae 100644 --- a/packages/core/src/test/shared/applicationBuilder/explorer/nodes/deployedNode.test.ts +++ b/packages/core/src/test/shared/applicationBuilder/explorer/nodes/deployedNode.test.ts @@ -223,8 +223,8 @@ describe('generateDeployedNode', () => { lambdaDeployedNodeInput.resourceTreeEntity ) - assert(loggerErrorStub.calledOnceWith('Error getting Lambda configuration')) - assert(loggerErrorStub.neverCalledWith('Error getting Lambda V3 configuration')) + assert(loggerErrorStub.calledOnceWith('Error getting Lambda configuration %O')) + assert(loggerErrorStub.neverCalledWith('Error getting Lambda V3 configuration %O')) assert(deployedResourceNodes.length === 1) // Check placeholder propertries @@ -375,10 +375,10 @@ describe('generateDeployedNode', () => { unsupportTypeInput.resourceTreeEntity ) - assert(loggerInfoStub.calledOnceWith('Details are missing or are incomplete for:')) + assert(loggerInfoStub.calledOnceWith('Details are missing or are incomplete for: %O')) // Check deployedResourceNodes array propertries - assert(loggerErrorStub.neverCalledWith('Error getting Lambda V3 configuration')) + assert(loggerErrorStub.neverCalledWith('Error getting Lambda V3 configuration %O')) // Check deployedResourceNodes array propertries assert(deployedResourceNodes.length === 1)