*.eval.ts (or .mts, .js, .mjs) and run with npx ezvals run or npx ezvals serve.
evaluate()
fn receives an EvalContext and may be async. Return nothing (the context becomes the result), a result object, or an array of result objects for several results. Anything else is an error.
Assertions become failing scores when the thrown error is named AssertionError, which covers node:assert and chai.
Evaluate options
A misspelled option, such as
datset, throws an error that suggests the closest valid name.
File defaults. export const ezvalsDefaults = { ... } sets any option except cases and inputLoader for every eval in the file. See File defaults.
A timeout can’t interrupt code that blocks the event loop. Such an eval is still reported as timed out, but only when the blocking code finishes.
EvalContext
ctx.store({...})
metadata and traceData merge.
Types
Target, Evaluator and EvalFn function types.
The TypeScript package has no equivalent of Python’s
run() or run_evals(). Use npx ezvals run --json from scripts.
