diff --git a/test/vike-node/server/index-uws.ts b/test/vike-node/server/index-uws.ts index 0daef9c..673eb1b 100644 --- a/test/vike-node/server/index-uws.ts +++ b/test/vike-node/server/index-uws.ts @@ -42,5 +42,14 @@ async function startServer() { // res.writeHeader('x-test', 'test') const port = process.env.PORT || 3000 - app.listen(+port, () => console.log(`Server running at http://localhost:${port}`)) + await new Promise((resolve, reject) => { + app.listen(+port, (listenSocket) => { + if (listenSocket) { + console.log(`Server running at http://localhost:${port}`) + resolve() + } else { + reject(`Failed to listen to port ${port}`) + } + }) + }) }