@@ -12,6 +12,7 @@ import {
12
12
13
13
import { detectProvider } from "../provider" ;
14
14
import { Output } from "../Output" ;
15
+ import chalk from "chalk" ;
15
16
16
17
vi . mock ( "../provider" ) ;
17
18
@@ -338,6 +339,31 @@ describe("Output", () => {
338
339
await output . write ( ) ;
339
340
} ) ;
340
341
342
+ it ( "logs error when debug is enabled" , async ( ) => {
343
+ setup ( { urlSendError : true } ) ;
344
+
345
+ const output = new Output ( {
346
+ apiUrl : "http://localhost" ,
347
+ bundleName : "output-test" ,
348
+ debug : true ,
349
+ dryRun : false ,
350
+ enableBundleAnalysis : true ,
351
+ retryCount : 1 ,
352
+ uploadToken : "token" ,
353
+ } ) ;
354
+
355
+ output . start ( ) ;
356
+ output . end ( ) ;
357
+
358
+ await output . write ( ) ;
359
+
360
+ expect ( consoleSpy ) . toHaveBeenCalledWith (
361
+ `[codecov] ${ chalk . italic . yellow (
362
+ 'Error getting pre-signed URL: "Error: Failed to fetch pre-signed URL"' ,
363
+ ) } `,
364
+ ) ;
365
+ } ) ;
366
+
341
367
it ( "optionally emits error" , async ( ) => {
342
368
setup ( { urlSendError : true } ) ;
343
369
@@ -430,6 +456,35 @@ describe("Output", () => {
430
456
await output . write ( ) ;
431
457
} ) ;
432
458
459
+ it ( "logs error when debug is enabled" , async ( ) => {
460
+ setup ( {
461
+ urlData : { url : "http://localhost/upload/stats/" } ,
462
+ urlStatus : 200 ,
463
+ statsSendError : true ,
464
+ } ) ;
465
+
466
+ const output = new Output ( {
467
+ apiUrl : "http://localhost" ,
468
+ bundleName : "output-test" ,
469
+ debug : true ,
470
+ dryRun : false ,
471
+ enableBundleAnalysis : true ,
472
+ retryCount : 1 ,
473
+ uploadToken : "token" ,
474
+ } ) ;
475
+
476
+ output . start ( ) ;
477
+ output . end ( ) ;
478
+
479
+ await output . write ( ) ;
480
+
481
+ expect ( consoleSpy ) . toHaveBeenCalledWith (
482
+ `[codecov] ${ chalk . italic . yellow (
483
+ 'Error uploading stats: "Error: Failed to upload stats"' ,
484
+ ) } `,
485
+ ) ;
486
+ } ) ;
487
+
433
488
it ( "optionally emits error" , async ( ) => {
434
489
setup ( {
435
490
urlData : { url : "http://localhost/upload/stats/" } ,
0 commit comments