test: ensure dev tests have separate buildDirs

This commit is contained in:
Daniel Roe 2025-03-04 20:37:40 +00:00
parent 82ca08f933
commit d7623f884c
No known key found for this signature in database
GPG Key ID: CBC814C393D93268
2 changed files with 10 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import { fileURLToPath } from 'node:url'
import { describe, expect, it } from 'vitest'
import { isWindows } from 'std-env'
import { $fetch, createPage, setup, url } from '@nuxt/test-utils/e2e'
import { join } from 'pathe'
const isWebpack =
process.env.TEST_BUILDER === 'webpack' ||
@ -9,14 +10,17 @@ const isWebpack =
const isDev = process.env.TEST_ENV === 'dev'
const fixtureDir = fileURLToPath(new URL('../fixtures/spa-loader', import.meta.url))
if (!isDev) {
await setup({
rootDir: fileURLToPath(new URL('../fixtures/spa-loader', import.meta.url)),
rootDir: fixtureDir,
dev: isDev,
server: true,
browser: true,
setupTimeout: (isWindows ? 360 : 120) * 1000,
nuxtConfig: {
buildDir: isDev ? join(fixtureDir, '.nuxt', 'test', Math.random().toString(36).slice(2, 8)) : undefined,
builder: isWebpack ? 'webpack' : 'vite',
spaLoadingTemplate: true,
experimental: {

View File

@ -3,17 +3,21 @@ import { describe, expect, it } from 'vitest'
import { isWindows } from 'std-env'
import { createPage, setup, url } from '@nuxt/test-utils/e2e'
import type { Page } from 'playwright-core'
import { join } from 'pathe'
const isWebpack = process.env.TEST_BUILDER === 'webpack' || process.env.TEST_BUILDER === 'rspack'
const isDev = process.env.TEST_ENV === 'dev'
const fixtureDir = fileURLToPath(new URL('../fixtures/spa-loader', import.meta.url))
if (!isDev) {
await setup({
rootDir: fileURLToPath(new URL('../fixtures/spa-loader', import.meta.url)),
rootDir: fixtureDir,
server: true,
browser: true,
setupTimeout: (isWindows ? 360 : 120) * 1000,
nuxtConfig: {
buildDir: isDev ? join(fixtureDir, '.nuxt', 'test', Math.random().toString(36).slice(2, 8)) : undefined,
builder: isWebpack ? 'webpack' : 'vite',
spaLoadingTemplate: true,
experimental: {