File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -182,6 +182,31 @@ describe('uploader', () => {
182182 expect ( mockCore . warning ) . toHaveBeenCalledTimes ( 2 ) ;
183183 } ) ;
184184
185+ it ( 'should retry on transient axios errors and log warning with axios message' , async ( ) => {
186+ const options : UploadOptions = {
187+ ...baseOptions ,
188+ files : [ { path : testFile , format : 'cobertura' } ] ,
189+ } ;
190+
191+ // Create an axios error with a 500 status (retryable)
192+ const axiosError = {
193+ response : { status : 500 , data : 'Internal Server Error' } ,
194+ message : 'Request failed with status code 500' ,
195+ isAxiosError : true ,
196+ } ;
197+ mockAxiosPost
198+ . mockRejectedValueOnce ( axiosError )
199+ . mockResolvedValueOnce ( { status : 200 , data : { } } as AxiosResponse ) ;
200+ mockIsAxiosError . mockReturnValue ( true ) ;
201+
202+ await uploadCoverageFiles ( options ) ;
203+
204+ expect ( mockAxiosPost ) . toHaveBeenCalledTimes ( 2 ) ;
205+ expect ( mockCore . warning ) . toHaveBeenCalledWith (
206+ 'Upload attempt 1/3 failed: Request failed with status code 500'
207+ ) ;
208+ } ) ;
209+
185210 it ( 'should fail immediately on 400 error' , async ( ) => {
186211 const options : UploadOptions = {
187212 ...baseOptions ,
You can’t perform that action at this time.
0 commit comments