Skip to content

Commit

Permalink
fix: promisify app.listen in test
Browse files Browse the repository at this point in the history
  • Loading branch information
rtritto committed Oct 24, 2024
1 parent 66b0b9b commit 9dd6074
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/vike-node/server/index-uws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>((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}`)
}
})
})
}

0 comments on commit 9dd6074

Please sign in to comment.