File tree Expand file tree Collapse file tree 3 files changed +17
-11
lines changed
amazonq/.changes/next-release Expand file tree Collapse file tree 3 files changed +17
-11
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "type" : " Bug Fix" ,
3
+ "description" : " /test: show descriptive error message"
4
+ }
Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ import { ChatSessionManager } from '../../amazonqTest/chat/storages/chatSession'
20
20
import { ChildProcess , spawn } from 'child_process' // eslint-disable-line no-restricted-imports
21
21
import { BuildStatus } from '../../amazonqTest/chat/session/session'
22
22
import { fs } from '../../shared/fs/fs'
23
- import { TestGenerationJobStatus } from '../models/constants'
24
- import { TestGenFailedError } from '../../amazonqTest/error'
25
23
import { Range } from '../client/codewhispereruserclient'
26
24
27
25
// eslint-disable-next-line unicorn/no-null
@@ -112,18 +110,13 @@ export async function startTestGenerationProcess(
112
110
if ( ! shouldContinueRunning ( tabID ) ) {
113
111
return
114
112
}
115
- const jobStatus = await pollTestJobStatus (
113
+ await pollTestJobStatus (
116
114
testJob . testGenerationJob . testGenerationJobId ,
117
115
testJob . testGenerationJob . testGenerationJobGroupName ,
118
116
filePath ,
119
117
initialExecution
120
118
)
121
119
// TODO: Send status to test summary
122
- if ( jobStatus === TestGenerationJobStatus . FAILED ) {
123
- session . numberOfTestsGenerated = 0
124
- logger . verbose ( `Test generation failed.` )
125
- throw new TestGenFailedError ( )
126
- }
127
120
throwIfCancelled ( )
128
121
if ( ! shouldContinueRunning ( tabID ) ) {
129
122
return
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
18
18
CreateUploadUrlError ,
19
19
ExportResultsArchiveError ,
20
20
InvalidSourceZipError ,
21
+ TestGenFailedError ,
21
22
TestGenStoppedError ,
22
23
TestGenTimedOutError ,
23
24
} from '../../amazonqTest/error'
@@ -193,9 +194,17 @@ export async function pollTestJobStatus(
193
194
}
194
195
}
195
196
ChatSessionManager . Instance . getSession ( ) . targetFileInfo = targetFileInfo
196
- if ( resp . testGenerationJob ?. status !== CodeWhispererConstants . TestGenerationJobStatus . IN_PROGRESS ) {
197
- // This can be FAILED or COMPLETED
198
- status = resp . testGenerationJob ?. status as CodeWhispererConstants . TestGenerationJobStatus
197
+ status = resp . testGenerationJob ?. status as CodeWhispererConstants . TestGenerationJobStatus
198
+ if ( status === CodeWhispererConstants . TestGenerationJobStatus . FAILED ) {
199
+ session . numberOfTestsGenerated = 0
200
+ logger . verbose ( `Test generation failed.` )
201
+ if ( resp . testGenerationJob ?. jobStatusReason ) {
202
+ session . stopIteration = true
203
+ throw new TestGenFailedError ( resp . testGenerationJob ?. jobStatusReason )
204
+ } else {
205
+ throw new TestGenFailedError ( )
206
+ }
207
+ } else if ( status === CodeWhispererConstants . TestGenerationJobStatus . COMPLETED ) {
199
208
logger . verbose ( `testgen job status: ${ status } ` )
200
209
logger . verbose ( `Complete polling test job status.` )
201
210
break
You can’t perform that action at this time.
0 commit comments