Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Amazon Q /test: Q identify active test file and infer source file for test generation."
}
17 changes: 7 additions & 10 deletions packages/core/src/amazonqTest/chat/controller/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ export class TestController {
* Get Diff from exportResultArchive API
*/
ChatSessionManager.Instance.setIsInProgress(true)
await startTestGenerationProcess(fileName, filePath, message.prompt, tabID, true, selectionRange)
await startTestGenerationProcess(filePath, message.prompt, tabID, true, selectionRange)
}
} catch (err: any) {
// TODO: refactor error handling to be more robust
Expand Down Expand Up @@ -549,12 +549,15 @@ export class TestController {
testGenerationJobGroupName: string
testGenerationJobId: string
type: ChatItemType
fileName: string
filePath: string
}) {
this.messenger.sendShortSummary({
type: 'answer',
tabID: message.tabID,
message: testGenSummaryMessage(message.fileName, message.shortAnswer?.planSummary?.replaceAll('```', '')),
message: testGenSummaryMessage(
path.basename(message.shortAnswer?.sourceFilePath ?? message.filePath),
message.shortAnswer?.planSummary?.replaceAll('```', '')
),
canBeVoted: true,
filePath: message.shortAnswer?.testFilePath,
})
Expand Down Expand Up @@ -1117,13 +1120,7 @@ export class TestController {
canBeVoted: false,
messageId: TestNamedMessages.TEST_GENERATION_BUILD_STATUS_MESSAGE,
})
await startTestGenerationProcess(
path.basename(session.sourceFilePath),
session.sourceFilePath,
'',
data.tabID,
false
)
await startTestGenerationProcess(session.sourceFilePath, '', data.tabID, false)
}
// TODO: Skip this if startTestGenerationProcess timeouts
if (session.generatedFilePath) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { Range } from '../client/codewhispereruserclient'
let spawnResult: ChildProcess | null = null
let isCancelled = false
export async function startTestGenerationProcess(
fileName: string,
filePath: string,
userInputPrompt: string,
tabID: string,
Expand Down Expand Up @@ -116,7 +115,7 @@ export async function startTestGenerationProcess(
const jobStatus = await pollTestJobStatus(
testJob.testGenerationJob.testGenerationJobId,
testJob.testGenerationJob.testGenerationJobGroupName,
fileName,
filePath,
initialExecution
)
// TODO: Send status to test summary
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/codewhisperer/service/testGenHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export async function createTestJob(
export async function pollTestJobStatus(
jobId: string,
jobGroupName: string,
fileName: string,
filePath: string,
initialExecution: boolean
) {
const session = ChatSessionManager.Instance.getSession()
Expand Down Expand Up @@ -187,7 +187,7 @@ export async function pollTestJobStatus(
shortAnswer,
testGenerationJobGroupName: resp.testGenerationJob?.testGenerationJobGroupName,
testGenerationJobId: resp.testGenerationJob?.testGenerationJobId,
fileName,
filePath,
})
}
}
Expand Down
Loading