// vitest.config.ts import { defineConfig } from "vitest/config" import { fileURLToPath } from "node:url" import solid from "vite-plugin-solid" // Mirrors the tsconfig path aliases so modules under test can import via @lib/... const src = fileURLToPath(new URL("./src", import.meta.url)) export default defineConfig({ // Compiles Solid JSX for the island render tests; Astro uses the same plugin for the app. plugins: [solid({ ssr: true })], resolve: { alias: { "@lib": `${src}/lib`, "@components": `${src}/components`, "@layouts": `${src}/layouts`, "@pages": `${src}/pages`, "@styles": `${src}/styles`, "@consts": `${src}/consts.ts`, "@types": `${src}/types.ts`, }, }, test: { environment: "node", include: ["src/**/__tests__/**/*.test.ts", "src/**/*.test.ts"], // Rolldown (Vite 8's bundler, loaded when Vitest reads this config) sizes // its native thread pool to `nproc`. On hosts that report many CPUs but // cannot actually spawn that many threads, the default `forks` pool aborts // with "spawn node EAGAIN". The `threads` pool with a single worker avoids // forking one child process per file; the matching RAYON/TOKIO caps live in // the package.json scripts. pool: "threads", maxWorkers: 1, fileParallelism: false, }, })