@@ -1459,93 +1459,6 @@ describe("TaskExecutor", () => {
14591459 } ) ;
14601460 } ) ;
14611461
1462- test ( "should handle max duration abort signal and call hooks in correct order" , async ( ) => {
1463- const executionOrder : string [ ] = [ ] ;
1464- const maxDurationSeconds = 1000 ;
1465-
1466- // Create an abort controller that we'll trigger manually
1467- const controller = new AbortController ( ) ;
1468-
1469- // Register global init hook
1470- lifecycleHooks . registerGlobalInitHook ( {
1471- id : "test-init" ,
1472- fn : async ( ) => {
1473- executionOrder . push ( "init" ) ;
1474- return {
1475- foo : "bar" ,
1476- } ;
1477- } ,
1478- } ) ;
1479-
1480- // Register failure hook
1481- lifecycleHooks . registerGlobalFailureHook ( {
1482- id : "global-failure" ,
1483- fn : async ( { error } ) => {
1484- executionOrder . push ( "failure" ) ;
1485- expect ( ( error as Error ) . message ) . toBe (
1486- `Run exceeded maximum compute time (maxDuration) of ${ maxDurationSeconds } seconds`
1487- ) ;
1488- } ,
1489- } ) ;
1490-
1491- // Register complete hook
1492- lifecycleHooks . registerGlobalCompleteHook ( {
1493- id : "global-complete" ,
1494- fn : async ( { result } ) => {
1495- executionOrder . push ( "complete" ) ;
1496- expect ( result . ok ) . toBe ( false ) ;
1497- } ,
1498- } ) ;
1499-
1500- // Register cleanup hook
1501- lifecycleHooks . registerGlobalCleanupHook ( {
1502- id : "global-cleanup" ,
1503- fn : async ( ) => {
1504- executionOrder . push ( "cleanup" ) ;
1505- } ,
1506- } ) ;
1507-
1508- const task = {
1509- id : "test-task" ,
1510- fns : {
1511- run : async ( payload : any , params : RunFnParams < any > ) => {
1512- executionOrder . push ( "run-start" ) ;
1513-
1514- // Create a promise that never resolves
1515- await new Promise ( ( resolve ) => {
1516- // Trigger abort after a small delay
1517- setTimeout ( ( ) => {
1518- controller . abort ( ) ;
1519- } , 10 ) ;
1520- } ) ;
1521-
1522- // This should never be reached
1523- executionOrder . push ( "run-end" ) ;
1524- } ,
1525- } ,
1526- } ;
1527-
1528- const result = await executeTask ( task , { test : "data" } , controller . signal ) ;
1529-
1530- // Verify hooks were called in correct order
1531- expect ( executionOrder ) . toEqual ( [ "init" , "run-start" , "failure" , "complete" , "cleanup" ] ) ;
1532-
1533- // Verify the error result
1534- expect ( result ) . toEqual ( {
1535- result : {
1536- ok : false ,
1537- id : "test-run-id" ,
1538- error : {
1539- type : "INTERNAL_ERROR" ,
1540- code : TaskRunErrorCodes . MAX_DURATION_EXCEEDED ,
1541- message : "Run exceeded maximum compute time (maxDuration) of 1000 seconds" ,
1542- stackTrace : expect . any ( String ) ,
1543- } ,
1544- skippedRetrying : false ,
1545- } ,
1546- } ) ;
1547- } ) ;
1548-
15491462 test ( "should call onWait and onResume hooks in correct order with proper data" , async ( ) => {
15501463 const executionOrder : string [ ] = [ ] ;
15511464 const waitData = { type : "task" , runId : "test-run-id" } as const ;
0 commit comments