Skip to content

possible regression: cannot use @nuxt/test-utils defineVitestProject directly in evalite.config.ts #390

Description

@vachmara

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:

  1. Existing Vitest project/workspace configs should compose directly with Evalite
  2. Evalite should provide an official adapter/helper for Vitest project configs
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions