( port: number, path: string, )
| 411 | const TEST_HOST = '127.0.0.1'; |
| 412 | |
| 413 | function fetchText( |
| 414 | port: number, |
| 415 | path: string, |
| 416 | ): Promise<{ |
| 417 | status: number; |
| 418 | body: string; |
| 419 | headers: Record<string, string | string[] | undefined>; |
| 420 | }> { |
| 421 | return new Promise((resolveFetch, reject) => { |
| 422 | const req = httpRequest({ hostname: '127.0.0.1', port, path, method: 'GET' }, (res) => { |
| 423 | let body = ''; |
| 424 | res.setEncoding('utf-8'); |
| 425 | res.on('data', (chunk) => { |
| 426 | body += chunk; |
| 427 | }); |
| 428 | res.on('end', () => { |
| 429 | resolveFetch({ status: res.statusCode ?? 0, body, headers: res.headers }); |
| 430 | }); |
| 431 | res.on('error', reject); |
| 432 | }); |
| 433 | req.on('error', reject); |
| 434 | req.end(); |
| 435 | }); |
| 436 | } |
| 437 | |
| 438 | describe('resolveCollabPort (collab vs UI-sibling port suppression)', () => { |
| 439 | test('explicit --port always wins', () => { |
no test coverage detected