diff --git a/packages/daemon/src/server.ts b/packages/daemon/src/server.ts index 8a97d2a..11ae70c 100644 --- a/packages/daemon/src/server.ts +++ b/packages/daemon/src/server.ts @@ -32,6 +32,9 @@ export function startServer(port: number, browserManager?: BrowserManager): Prom }); } -// Direct start when running as script -const port = parseInt(process.env.VISIONL_PORT || '9527', 10); -startServer(port); +// Direct start when running as script (not when imported in tests) +// When imported by other modules, the caller is responsible for calling startServer() +if (process.argv[1] && (process.argv[1].endsWith('server.js') || process.argv[1].endsWith('server.ts'))) { + const port = parseInt(process.env.VISIONL_PORT || '9527', 10); + startServer(port); +}