Fix integration tests for Windows (#16693)

The Nuxt preview server always starts on port 3000 even if that port is
taken. With the added tests in #16631 there is now a higher chance these
ports are already taken since e.g. react router prefers to start at port
3000 and so do other servers.
This PR changes this so that we assign a random port inside the test
instead.

## Test plan

- Ensure Windows CI is green again
This commit is contained in:
Philipp Spiess 2025-02-20 17:50:50 +01:00 committed by GitHub
parent 3f270d2d9b
commit 1d56525fa0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -76,7 +76,9 @@ test('dev mode', SETUP, async ({ fs, spawn, expect }) => {
test('build', SETUP, async ({ spawn, exec, expect }) => {
await exec('pnpm nuxt build')
let process = await spawn('pnpm nuxt preview', {
// The Nuxt preview server does not automatically assign a free port if 3000
// is taken, so we use a random port instead.
let process = await spawn(`pnpm nuxt preview --port 8724`, {
env: {
TEST: 'false',
NODE_ENV: 'development',