codeburn/app/vitest.config.ts
Resham Joshi b92cf11c92
chore(deps): move vitest to 5.0.5 in root, app and vscode (#1833)
vitest 5 declares vite as a peer dependency only, so root and vscode now
name vite ^7.3.7 themselves. Without that, a fresh lock resolves the peer to
vite 8, which vscode's esbuild pin rejects and which pulls rolldown and
lightningcss into the root install.
2026-11-02 19:51:00 +01:00

28 lines
1.2 KiB
TypeScript

import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
// Default env is node (for electron/cli tests). Renderer component tests opt
// into jsdom with a `// @vitest-environment jsdom` docblock.
// Node 25 turned the built-in localStorage on by default, and it shadows jsdom's:
// the renderer tests that use it fail with "--localstorage-file was not provided".
// The flag has existed since Node 22.4 but not before it, so it is passed only
// when this Node admits it — an unknown flag would stop the worker from starting.
const execArgv = process.allowedNodeEnvironmentFlags.has('--no-experimental-webstorage')
? ['--no-experimental-webstorage']
: []
export default defineConfig({
plugins: [react()],
test: {
execArgv,
environment: 'node',
// Node's --localstorage-file backs localStorage with one file shared by every
// worker, so parallel files clobber each other's keys via the afterEach clear
// in setup.ts. Run files sequentially to keep localStorage isolated per file.
fileParallelism: false,
env: { CODEBURN_APP_FILTER: '' },
globals: false,
setupFiles: ['./renderer/test/setup.ts'],
include: ['renderer/**/*.test.{ts,tsx}', 'electron/**/*.test.ts', 'scripts/**/*.test.ts'],
},
})