@@ -6,13 +6,16 @@ vi.mock('../utils/exec.ts', () => ({
66 runCmdStreaming : vi . fn ( ) ,
77} ) ) ;
88
9- vi . mock ( '../client-metro -companion.ts' , ( ) => ( {
10- ensureMetroCompanion : vi . fn ( ) ,
11- stopMetroCompanion : vi . fn ( ) ,
9+ vi . mock ( '../client-react-devtools -companion.ts' , ( ) => ( {
10+ ensureReactDevtoolsCompanion : vi . fn ( ) ,
11+ stopReactDevtoolsCompanion : vi . fn ( ) ,
1212} ) ) ;
1313
1414import { runCmdStreaming } from '../utils/exec.ts' ;
15- import { ensureMetroCompanion , stopMetroCompanion } from '../client-metro-companion.ts' ;
15+ import {
16+ ensureReactDevtoolsCompanion ,
17+ stopReactDevtoolsCompanion ,
18+ } from '../client-react-devtools-companion.ts' ;
1619import {
1720 AGENT_REACT_DEVTOOLS_PACKAGE ,
1821 buildReactDevtoolsNpmExecArgs ,
@@ -54,13 +57,13 @@ test('react-devtools starts remote Android companion around passthrough command'
5457 stdout : '' ,
5558 stderr : '' ,
5659 } ) ;
57- vi . mocked ( ensureMetroCompanion ) . mockResolvedValueOnce ( {
60+ vi . mocked ( ensureReactDevtoolsCompanion ) . mockResolvedValueOnce ( {
5861 pid : 123 ,
5962 spawned : true ,
6063 statePath : '/tmp/state.json' ,
6164 logPath : '/tmp/companion.log' ,
6265 } ) ;
63- vi . mocked ( stopMetroCompanion ) . mockResolvedValueOnce ( {
66+ vi . mocked ( stopReactDevtoolsCompanion ) . mockResolvedValueOnce ( {
6467 stopped : true ,
6568 statePath : '/tmp/state.json' ,
6669 } ) ;
@@ -84,22 +87,17 @@ test('react-devtools starts remote Android companion around passthrough command'
8487 } ) ;
8588
8689 assert . equal ( exitCode , 0 ) ;
87- assert . equal ( vi . mocked ( ensureMetroCompanion ) . mock . calls . length , 1 ) ;
88- assert . deepEqual ( vi . mocked ( ensureMetroCompanion ) . mock . calls [ 0 ] ?. [ 0 ] , {
90+ assert . equal ( vi . mocked ( ensureReactDevtoolsCompanion ) . mock . calls . length , 1 ) ;
91+ assert . deepEqual ( vi . mocked ( ensureReactDevtoolsCompanion ) . mock . calls [ 0 ] ?. [ 0 ] , {
8992 projectRoot : '/tmp/project' ,
9093 stateDir : '/tmp/agent-device-state' ,
91- kind : 'react-devtools' ,
9294 serverBaseUrl : 'https://bridge.example.test' ,
9395 bearerToken : 'token' ,
94- localBaseUrl : 'http://127.0.0.1:8097' ,
9596 bridgeScope : {
9697 tenantId : 'tenant-1' ,
9798 runId : 'run-1' ,
9899 leaseId : 'lease-1' ,
99100 } ,
100- registerPath : '/api/react-devtools/companion/register' ,
101- unregisterPath : '/api/react-devtools/companion/unregister' ,
102- devicePort : 8097 ,
103101 session : 'default' ,
104102 profileKey : '/tmp/remote.json' ,
105103 consumerKey : 'default' ,
@@ -108,11 +106,10 @@ test('react-devtools starts remote Android companion around passthrough command'
108106 assert . equal ( vi . mocked ( runCmdStreaming ) . mock . calls [ 0 ] ?. [ 0 ] , 'npm' ) ;
109107 assert . equal ( vi . mocked ( runCmdStreaming ) . mock . calls [ 0 ] ?. [ 2 ] ?. cwd , '/tmp/project' ) ;
110108 assert . equal ( vi . mocked ( runCmdStreaming ) . mock . calls [ 0 ] ?. [ 2 ] ?. env , env ) ;
111- assert . equal ( vi . mocked ( stopMetroCompanion ) . mock . calls . length , 1 ) ;
112- assert . deepEqual ( vi . mocked ( stopMetroCompanion ) . mock . calls [ 0 ] ?. [ 0 ] , {
109+ assert . equal ( vi . mocked ( stopReactDevtoolsCompanion ) . mock . calls . length , 1 ) ;
110+ assert . deepEqual ( vi . mocked ( stopReactDevtoolsCompanion ) . mock . calls [ 0 ] ?. [ 0 ] , {
113111 projectRoot : '/tmp/project' ,
114112 stateDir : '/tmp/agent-device-state' ,
115- kind : 'react-devtools' ,
116113 profileKey : '/tmp/remote.json' ,
117114 consumerKey : 'default' ,
118115 } ) ;
@@ -138,8 +135,8 @@ test('react-devtools skips companion for non-Android remote sessions', async ()
138135 } ,
139136 } ) ;
140137
141- assert . equal ( vi . mocked ( ensureMetroCompanion ) . mock . calls . length , 0 ) ;
142- assert . equal ( vi . mocked ( stopMetroCompanion ) . mock . calls . length , 0 ) ;
138+ assert . equal ( vi . mocked ( ensureReactDevtoolsCompanion ) . mock . calls . length , 0 ) ;
139+ assert . equal ( vi . mocked ( stopReactDevtoolsCompanion ) . mock . calls . length , 0 ) ;
143140} ) ;
144141
145142test ( 'react-devtools fails clearly when remote Android bridge scope is incomplete' , async ( ) => {
@@ -161,5 +158,5 @@ test('react-devtools fails clearly when remote Android bridge scope is incomplet
161158 ) ;
162159
163160 assert . equal ( vi . mocked ( runCmdStreaming ) . mock . calls . length , 0 ) ;
164- assert . equal ( vi . mocked ( ensureMetroCompanion ) . mock . calls . length , 0 ) ;
161+ assert . equal ( vi . mocked ( ensureReactDevtoolsCompanion ) . mock . calls . length , 0 ) ;
165162} ) ;
0 commit comments