fix: guard auto-start server to only run when executed directly, not when imported by tests
This commit is contained in:
@@ -32,6 +32,9 @@ export function startServer(port: number, browserManager?: BrowserManager): Prom
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Direct start when running as script
|
// 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);
|
const port = parseInt(process.env.VISIONL_PORT || '9527', 10);
|
||||||
startServer(port);
|
startServer(port);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user