From 427dc155fa32d54ee67fa7848affdb522bd74016 Mon Sep 17 00:00:00 2001 From: Jacob Chung Date: Mon, 13 Jan 2025 10:03:27 -0800 Subject: [PATCH] numberOfTestsGenerated is correctly emitted as 0 --- .../core/src/codewhisperer/commands/startTestGeneration.ts | 1 + packages/core/src/codewhisperer/service/testGenHandler.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/packages/core/src/codewhisperer/commands/startTestGeneration.ts b/packages/core/src/codewhisperer/commands/startTestGeneration.ts index 25264370c37..3b0f41ab1d6 100644 --- a/packages/core/src/codewhisperer/commands/startTestGeneration.ts +++ b/packages/core/src/codewhisperer/commands/startTestGeneration.ts @@ -120,6 +120,7 @@ export async function startTestGenerationProcess( ) // TODO: Send status to test summary if (jobStatus === TestGenerationJobStatus.FAILED) { + session.numberOfTestsGenerated = 0 logger.verbose(`Test generation failed.`) throw new TestGenFailedError() } diff --git a/packages/core/src/codewhisperer/service/testGenHandler.ts b/packages/core/src/codewhisperer/service/testGenHandler.ts index 36f5b5b1d63..203dcd8eb03 100644 --- a/packages/core/src/codewhisperer/service/testGenHandler.ts +++ b/packages/core/src/codewhisperer/service/testGenHandler.ts @@ -222,6 +222,8 @@ export async function exportResultsArchive( await fs.mkdir(pathToArchiveDir) let downloadErrorMessage = undefined + + const session = ChatSessionManager.Instance.getSession() try { const pathToArchive = path.join(pathToArchiveDir, 'QTestGeneration.zip') // Download and deserialize the zip @@ -248,6 +250,7 @@ export async function exportResultsArchive( }) } } catch (e) { + session.numberOfTestsGenerated = 0 downloadErrorMessage = (e as Error).message getLogger().error(`Unit Test Generation: ExportResultArchive error = ${downloadErrorMessage}`) throw new Error('Error downloading test generation result artifacts: ' + downloadErrorMessage)