Since recent Evalite versions, using defineVitestProject() from @nuxt/test-utils directly in evalite.config.ts is no longer practical in my setup, although I haven’t yet identified the exact change that caused this (could be on Evalite, Vitest, or Nuxt test-utils side)
Before, I could plug Nuxt test-utils config directly.
Now I need to manually strip/hoist fields (setupFiles, testTimeout, maxConcurrency, include) to avoid Evalite validation/override behavior.
Environment
- evalite:
1.0.0-beta.16
- vitest:
4.1.x
- @nuxt/test-utils:
4.0.x
- nuxt:
4.4.x
- OS: Windows
Reproduction
evalite.config.ts:
import { defineConfig } from 'evalite/config'
import { defineVitestProject } from '@nuxt/test-utils/config'
const ai = await defineVitestProject({
test: {
name: 'ai',
include: ['test/ai/*.{test,eval}.ts'],
environment: 'nuxt'
}
})
export default defineConfig({
viteConfig: {
test: {
projects: [ai]
}
}
})
test.eval.ts:
import { evalite } from "evalite";
evalite("My Eval", {
data: [{ input: "Hello" }],
task: async (input) => {
return input + " Paris!";
},
scorers: [
{
name: "Contains Paris",
description: "Checks if the output contains the word 'Paris'.",
scorer: ({ output }) => {
return output.includes("Paris") ? 1 : 0;
},
},
],
});
Run:
npx evalite run test.eval.ts
Actual behavior
test.projects path is not usable in practice with Evalite’s inline Vitest creation.
- Some fields (e.g. setupFiles, testTimeout, maxConcurrency, include) appear to be either restricted or overridden by Evalite, which makes direct reuse of existing Vitest project config more difficult.
- Evalite also overrides
include/config/watch/mode, which makes direct reuse of project config difficult.
I might be missing something in how these pieces are expected to integrate, so happy to be corrected if there is a supported pattern I overlooked.
Expected behavior
One of:
- Existing Vitest project/workspace configs should compose directly with Evalite
- Evalite should provide an official adapter/helper for Vitest project configs
- The supported integration pattern should be clearly documented, including how to migrate existing Vitest-based setups
Current workaround
I must split and sanitize config manually:
- hoist
setupFiles to Evalite root
- strip Evalite-forbidden/overridden
test fields
- pass only top-level Vite/Nuxt parts into
viteConfig
import { defineConfig } from 'evalite/config'
import { defineVitestProject } from '@nuxt/test-utils/config'
const ai = await defineVitestProject({
test: {
name: 'ai',
include: ['test/ai/*.{test,eval}.ts'],
environment: 'nuxt',
hookTimeout: 60_000
}
})
// Evalite-safe: strips workspace projects, hoists Nuxt plugins top-level
const { test: aiTestRaw, ...aiVite } = ai
const { setupFiles, testTimeout: _tt, maxConcurrency: _mc, include: _inc, ...aiTest } = aiTestRaw ?? {}
const evaliteSetupFiles = Array.isArray(setupFiles) ? setupFiles : setupFiles ? [setupFiles] : []
const evaliteViteConfig = { ...aiVite, test: aiTest }
export default defineConfig({
scoreThreshold: 75,
testTimeout: 10 * 60 * 1000,
setupFiles: evaliteSetupFiles,
viteConfig: evaliteViteConfig
})
This workaround works for now, but feels brittle and requires manual reshaping of an already valid Vitest config.
Since recent Evalite versions, using
defineVitestProject()from@nuxt/test-utilsdirectly inevalite.config.tsis no longer practical in my setup, although I haven’t yet identified the exact change that caused this (could be on Evalite, Vitest, or Nuxt test-utils side)Before, I could plug Nuxt test-utils config directly.
Now I need to manually strip/hoist fields (
setupFiles,testTimeout,maxConcurrency,include) to avoid Evalite validation/override behavior.Environment
1.0.0-beta.164.1.x4.0.x4.4.xReproduction
evalite.config.ts:test.eval.ts:Run:
Actual behavior
test.projectspath is not usable in practice with Evalite’s inline Vitest creation.include/config/watch/mode, which makes direct reuse of project config difficult.I might be missing something in how these pieces are expected to integrate, so happy to be corrected if there is a supported pattern I overlooked.
Expected behavior
One of:
Current workaround
I must split and sanitize config manually:
setupFilesto Evalite roottestfieldsviteConfigThis workaround works for now, but feels brittle and requires manual reshaping of an already valid Vitest config.