@@ -204,7 +204,11 @@ describe('HookRunner', () => {
204204 } ;
205205
206206 it ( 'should execute command hook successfully' , async ( ) => {
207- const mockOutput = { decision : 'allow' , reason : 'All good' } ;
207+ const mockOutput = {
208+ decision : 'allow' ,
209+ reason : 'All good' ,
210+ format : 'json' ,
211+ } ;
208212
209213 // Mock successful execution
210214 mockSpawn . mockStdoutOn . mockImplementation (
@@ -623,6 +627,7 @@ describe('HookRunner', () => {
623627 hookSpecificOutput : {
624628 additionalContext : 'Context from hook 1' ,
625629 } ,
630+ format : 'json' ,
626631 } ;
627632
628633 let hookCallCount = 0 ;
@@ -803,6 +808,7 @@ describe('HookRunner', () => {
803808 expect ( result . success ) . toBe ( true ) ;
804809 expect ( result . exitCode ) . toBe ( 0 ) ;
805810 // Should convert plain text to structured output
811+ expect ( result . outputFormat ) . toBe ( 'text' ) ;
806812 expect ( result . output ) . toEqual ( {
807813 decision : 'allow' ,
808814 systemMessage : invalidJson ,
@@ -835,6 +841,7 @@ describe('HookRunner', () => {
835841 ) ;
836842
837843 expect ( result . success ) . toBe ( true ) ;
844+ expect ( result . outputFormat ) . toBe ( 'text' ) ;
838845 expect ( result . output ) . toEqual ( {
839846 decision : 'allow' ,
840847 systemMessage : malformedJson ,
@@ -868,6 +875,7 @@ describe('HookRunner', () => {
868875
869876 expect ( result . success ) . toBe ( false ) ;
870877 expect ( result . exitCode ) . toBe ( 1 ) ;
878+ expect ( result . outputFormat ) . toBe ( 'text' ) ;
871879 expect ( result . output ) . toEqual ( {
872880 decision : 'allow' ,
873881 systemMessage : `Warning: ${ invalidJson } ` ,
@@ -901,6 +909,7 @@ describe('HookRunner', () => {
901909
902910 expect ( result . success ) . toBe ( false ) ;
903911 expect ( result . exitCode ) . toBe ( 2 ) ;
912+ expect ( result . outputFormat ) . toBe ( 'text' ) ;
904913 expect ( result . output ) . toEqual ( {
905914 decision : 'deny' ,
906915 reason : invalidJson ,
@@ -936,7 +945,11 @@ describe('HookRunner', () => {
936945 } ) ;
937946
938947 it ( 'should handle double-encoded JSON string' , async ( ) => {
939- const mockOutput = { decision : 'allow' , reason : 'All good' } ;
948+ const mockOutput = {
949+ decision : 'allow' ,
950+ reason : 'All good' ,
951+ format : 'json' ,
952+ } ;
940953 const doubleEncodedJson = JSON . stringify ( JSON . stringify ( mockOutput ) ) ;
941954
942955 mockSpawn . mockStdoutOn . mockImplementation (
0 commit comments