@@ -3,10 +3,12 @@ import type { GatewayProbeResult } from "../../gateway/probe.js";
33import type { RuntimeEnv } from "../../runtime.js" ;
44import type { GatewayStatusProbedTarget } from "./probe-run.js" ;
55
6- const writeRuntimeJson = vi . fn ( ) ;
6+ const mocks = vi . hoisted ( ( ) => ( {
7+ writeRuntimeJson : vi . fn ( ) ,
8+ } ) ) ;
79
810vi . mock ( "../../runtime.js" , ( ) => ( {
9- writeRuntimeJson : ( ...args : unknown [ ] ) => writeRuntimeJson ( ...args ) ,
11+ writeRuntimeJson : ( ...args : unknown [ ] ) => mocks . writeRuntimeJson ( ...args ) ,
1012} ) ) ;
1113
1214vi . mock ( "../../terminal/theme.js" , async ( ) => {
@@ -78,7 +80,7 @@ function createTarget(id: string, probe: GatewayProbeResult): GatewayStatusProbe
7880
7981describe ( "gateway status output" , ( ) => {
8082 beforeEach ( ( ) => {
81- writeRuntimeJson . mockReset ( ) ;
83+ mocks . writeRuntimeJson . mockReset ( ) ;
8284 } ) ;
8385
8486 it ( "warns with diagnostic next steps when no probes or Bonjour discovery find a gateway" , ( ) => {
@@ -143,7 +145,7 @@ describe("gateway status output", () => {
143145 primaryTargetId : "reachable-read" ,
144146 } ) ;
145147
146- expect ( writeRuntimeJson ) . toHaveBeenCalledWith (
148+ expect ( mocks . writeRuntimeJson ) . toHaveBeenCalledWith (
147149 runtime ,
148150 expect . objectContaining ( {
149151 ok : true ,
@@ -217,7 +219,7 @@ describe("gateway status output", () => {
217219 primaryTargetId : "detail-timeout" ,
218220 } ) ;
219221
220- expect ( writeRuntimeJson ) . toHaveBeenCalledWith (
222+ expect ( mocks . writeRuntimeJson ) . toHaveBeenCalledWith (
221223 runtime ,
222224 expect . objectContaining ( {
223225 ok : true ,
0 commit comments