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)