@@ -1358,12 +1358,17 @@ describe("Cline", () => {
13581358 } )
13591359
13601360 it ( "should handle pending ask operations gracefully when task is aborted" , async ( ) => {
1361- const [ cline , task ] = Task . create ( {
1361+ const [ cline , taskPromise ] = Task . create ( {
13621362 provider : mockProvider ,
13631363 apiConfiguration : mockApiConfig ,
13641364 task : "test task" ,
13651365 } )
13661366
1367+ // Handle the task promise to prevent unhandled rejection
1368+ taskPromise . catch ( ( ) => {
1369+ // Expected error when task is aborted
1370+ } )
1371+
13671372 // Start an ask operation but don't respond to it
13681373 const askPromise = cline . ask ( "tool" , "Test question" )
13691374
@@ -1381,12 +1386,17 @@ describe("Cline", () => {
13811386 } )
13821387
13831388 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 ( {
13851390 provider : mockProvider ,
13861391 apiConfiguration : mockApiConfig ,
13871392 task : "test task" ,
13881393 } )
13891394
1395+ // Handle the task promise to prevent unhandled rejection
1396+ taskPromise . catch ( ( ) => {
1397+ // Expected error when task is aborted
1398+ } )
1399+
13901400 // Start multiple ask operations
13911401 const askPromise1 = cline . ask ( "tool" , "Question 1" )
13921402 const askPromise2 = cline . ask ( "tool" , "Question 2" )
@@ -1400,12 +1410,17 @@ describe("Cline", () => {
14001410 } )
14011411
14021412 it ( "should resolve pending ask with messageResponse when abortTask is called" , async ( ) => {
1403- const [ cline , task ] = Task . create ( {
1413+ const [ cline , taskPromise ] = Task . create ( {
14041414 provider : mockProvider ,
14051415 apiConfiguration : mockApiConfig ,
14061416 task : "test task" ,
14071417 } )
14081418
1419+ // Handle the task promise to prevent unhandled rejection
1420+ taskPromise . catch ( ( ) => {
1421+ // Expected error when task is aborted
1422+ } )
1423+
14091424 // Spy on the ask response properties
14101425 // Start an ask operation
14111426 const askPromise = cline . ask ( "tool" , "Test question" )
0 commit comments