mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(test-utils): pass along error if server can't start (#22216)
This commit is contained in:
parent
fb77cc04c7
commit
61146aacaf
@ -28,6 +28,7 @@ export async function startServer () {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
await waitForPort(port, { retries: 32 })
|
await waitForPort(port, { retries: 32 })
|
||||||
|
let lastError
|
||||||
for (let i = 0; i < 50; i++) {
|
for (let i = 0; i < 50; i++) {
|
||||||
await new Promise(resolve => setTimeout(resolve, 100))
|
await new Promise(resolve => setTimeout(resolve, 100))
|
||||||
try {
|
try {
|
||||||
@ -35,10 +36,12 @@ export async function startServer () {
|
|||||||
if (!res.includes('__NUXT_LOADING__')) {
|
if (!res.includes('__NUXT_LOADING__')) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch (e) {
|
||||||
|
lastError = e
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ctx.serverProcess.kill()
|
ctx.serverProcess.kill()
|
||||||
throw new Error('Timeout waiting for dev server!')
|
throw lastError || new Error('Timeout waiting for dev server!')
|
||||||
} else {
|
} else {
|
||||||
ctx.serverProcess = execa('node', [
|
ctx.serverProcess = execa('node', [
|
||||||
resolve(ctx.nuxt!.options.nitro.output!.dir!, 'server/index.mjs')
|
resolve(ctx.nuxt!.options.nitro.output!.dir!, 'server/index.mjs')
|
||||||
|
Loading…
Reference in New Issue
Block a user