Skip to content

Conversation

@gmickel
Copy link

@gmickel gmickel commented Nov 26, 2025

Summary

This PR adds first-class support for watching additional files in Evalite watch mode, so evals can rerun when dependent files (e.g. prompts, data, helper code) change, not just *.eval.ts files.

Changes

  • Config API

    • Add watchFiles?: string[] to Evalite.Config.
    • Update defineConfig JSDoc example to show watchFiles usage.
    • Globs are interpreted the same way as Vitest's test.forceRerunTriggers (relative to the Evalite working directory / Vitest root).
  • Node API

    • Extend runEvalite with a new watchFiles?: string[] option.
    • Node API watchFiles overrides evalite.config.ts (even when set to []).
    • Wire watchFiles into the Vitest plugin by merging them into config.test.forceRerunTriggers, preserving Vitest defaults via configDefaults.forceRerunTriggers.
    • Add an optional configDebugMode debug output that logs root, testTimeout, maxConcurrency, and effective forceRerunTriggers.
  • Tests

    • New watch-files.test.ts to verify:
      • watchFiles from evalite.config.ts are applied to Vitest forceRerunTriggers.
      • Node API watchFiles overrides the config values.
      • Passing an empty watchFiles array results in only Vitest defaults.
    • Update loadFixture helper to forward watchFiles into runEvalite.
  • Docs

    • CLI guide:
      • Document "Watching Additional Files" with watchFiles examples.
      • Clarify that globs are resolved relative to the directory where you run evalite (Vitest root).
    • Configuration guide:
      • Add watchFiles to the list of available options and link to the CLI guide for details.
    • Running programmatically:
      • Document the watchFiles option on the Node API.
      • Add a TIP explaining that globs are evaluated relative to cwd (or process.cwd()).

Motivation

Eval files often depend on prompts, model/helper code, or external data that Vitest can't automatically detect as dependencies. Previously, evalite watch only retriggered when *.eval.ts files changed.

With this change, users can:

  • Configure additional watch globs in evalite.config.ts, and/or
  • Override them per invocation via the Node API.

This makes watch mode much more ergonomic for real-world LLM eval setups.

Behaviour and compatibility

  • Behaviour is fully backward compatible:
    • If watchFiles is not set, Evalite falls back to Vitest's default forceRerunTriggers.
    • Passing watchFiles: [] via the Node API disables extra triggers from evalite.config.ts while retaining Vitest defaults.
  • watchFiles only affects watch/serve workflows:
    • run-once-and-exit mode is unaffected.

@changeset-bot
Copy link

changeset-bot bot commented Nov 26, 2025

🦋 Changeset detected

Latest commit: 802fece

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Nov 26, 2025

@gmickel is attempting to deploy a commit to the Skill Recordings Team on Vercel.

A member of the Team first needs to authorize it.

@mattpocock
Copy link
Owner

@gmickel Let's match the Vitest naming on this: make it forceRerunTriggers as well.

@mattpocock
Copy link
Owner

Also - apologies @gmickel but most development is now happening on the #240 branch, so rebasing the PR there would be very helpful.

@gmickel
Copy link
Author

gmickel commented Nov 26, 2025

Should be good now

@mattpocock mattpocock changed the base branch from main to v1 November 26, 2025 12:17
@mattpocock
Copy link
Owner

@gmickel The docs updates need to be re-done

@gmickel
Copy link
Author

gmickel commented Nov 26, 2025

Serves me right for doing this while in a meeting

@mattpocock mattpocock added this to the v1 milestone Dec 3, 2025
@mattpocock
Copy link
Owner

Looking good, cleaned things up a little bit and changed the behavior to match Vitest's. Merging soon!

@mattpocock mattpocock merged commit 7f73ec0 into mattpocock:v1 Dec 3, 2025
0 of 3 checks passed
@gmickel
Copy link
Author

gmickel commented Dec 3, 2025

Looking good, cleaned things up a little bit and changed the behavior to match Vitest's. Merging soon!

Awesome, thanks @mattpocock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants