MCPcopy
hub / github.com/cloudflare/vibesdk / createPortBindScript

Function createPortBindScript

container/monitor-cli.test.ts:2483–2500  ·  view source on GitHub ↗
(port: number)

Source from the content-addressed store, hash-verified

2481describe('Health Check: Port Monitoring', () => {
2482 // Mock script that binds to a port (using Bun's built-in server)
2483 const createPortBindScript = (port: number) => `
2484 const pinoLog = (level, msg) => console.log(JSON.stringify({
2485 level, msg, time: Date.now()
2486 }));
2487
2488 pinoLog(30, 'Starting server...');
2489
2490 Bun.serve({
2491 port: ${port},
2492 fetch(req) {
2493 return new Response('OK');
2494 }
2495 });
2496
2497 pinoLog(30, 'Server listening on port ${port}');
2498 // Keep alive
2499 setInterval(() => {}, 1000);
2500 `;
2501
2502 // Script that doesn't bind to any port (simulates misconfigured server that hangs)
2503 const noPortBindScript = `

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected