@@ -1358,12 +1358,17 @@ describe("Cline", () => {
1358
1358
} )
1359
1359
1360
1360
it ( "should handle pending ask operations gracefully when task is aborted" , async ( ) => {
1361
- const [ cline , task ] = Task . create ( {
1361
+ const [ cline , taskPromise ] = Task . create ( {
1362
1362
provider : mockProvider ,
1363
1363
apiConfiguration : mockApiConfig ,
1364
1364
task : "test task" ,
1365
1365
} )
1366
1366
1367
+ // Handle the task promise to prevent unhandled rejection
1368
+ taskPromise . catch ( ( ) => {
1369
+ // Expected error when task is aborted
1370
+ } )
1371
+
1367
1372
// Start an ask operation but don't respond to it
1368
1373
const askPromise = cline . ask ( "tool" , "Test question" )
1369
1374
@@ -1381,12 +1386,17 @@ describe("Cline", () => {
1381
1386
} )
1382
1387
1383
1388
it ( "should not throw 'Current ask promise was ignored' error when task is aborted" , async ( ) => {
1384
- const [ cline , task ] = Task . create ( {
1389
+ const [ cline , taskPromise ] = Task . create ( {
1385
1390
provider : mockProvider ,
1386
1391
apiConfiguration : mockApiConfig ,
1387
1392
task : "test task" ,
1388
1393
} )
1389
1394
1395
+ // Handle the task promise to prevent unhandled rejection
1396
+ taskPromise . catch ( ( ) => {
1397
+ // Expected error when task is aborted
1398
+ } )
1399
+
1390
1400
// Start multiple ask operations
1391
1401
const askPromise1 = cline . ask ( "tool" , "Question 1" )
1392
1402
const askPromise2 = cline . ask ( "tool" , "Question 2" )
@@ -1400,12 +1410,17 @@ describe("Cline", () => {
1400
1410
} )
1401
1411
1402
1412
it ( "should resolve pending ask with messageResponse when abortTask is called" , async ( ) => {
1403
- const [ cline , task ] = Task . create ( {
1413
+ const [ cline , taskPromise ] = Task . create ( {
1404
1414
provider : mockProvider ,
1405
1415
apiConfiguration : mockApiConfig ,
1406
1416
task : "test task" ,
1407
1417
} )
1408
1418
1419
+ // Handle the task promise to prevent unhandled rejection
1420
+ taskPromise . catch ( ( ) => {
1421
+ // Expected error when task is aborted
1422
+ } )
1423
+
1409
1424
// Spy on the ask response properties
1410
1425
// Start an ask operation
1411
1426
const askPromise = cline . ask ( "tool" , "Test question" )
0 commit comments