(
result: Record<string, unknown>,
status: ServiceStatus | undefined,
fallback?: { host: string; port: number },
)
| 231 | } |
| 232 | |
| 233 | function withStatusDetails( |
| 234 | result: Record<string, unknown>, |
| 235 | status: ServiceStatus | undefined, |
| 236 | fallback?: { host: string; port: number }, |
| 237 | ): Record<string, unknown> & { url?: string; running?: boolean } { |
| 238 | const host = status?.host ?? fallback?.host; |
| 239 | const port = status?.port ?? fallback?.port; |
| 240 | const url = host !== undefined && port !== undefined ? formatServiceUrl(host, port) : undefined; |
| 241 | return { |
| 242 | ...result, |
| 243 | url, |
| 244 | running: status?.running, |
| 245 | host, |
| 246 | port, |
| 247 | logPath: status?.logPath, |
| 248 | notes: status?.notes, |
| 249 | }; |
| 250 | } |
| 251 | |
| 252 | function formatServiceUrl(host: string, port: number): string { |
| 253 | return serverOrigin(host === '0.0.0.0' ? LOCAL_SERVER_HOST : host, port); |
no test coverage detected