A JavaScript support bot whose AI call is tested on every pull request with tinyeval.
Clone this repo or use it as a template. Then:
npm ci
export ANTHROPIC_API_KEY=sk-ant-...
npx tinyevalsupport
✓ refund after the window 4.9s
✓ missing package 4.3s
✓ refund inside the window 4.5s
All 3 evals passed (eval-results.json)
src/support.js: the bot.answer(message)calls Claude with the official@anthropic-ai/sdk.prompts/support.md: the system prompt.evals/worker.js: loads the bot once and answers each test case, with the worker helper fromtinyeval-cli.evals/support.sh: three test cases, each checked by a regex, a judge or both..github/workflows/evals.yml: runs the evals on every pull request and push to main.
Plain ES modules on Node.js 22 or later, with no build step.
- Replace
answerwith your AI call. Keep the worker, so your app starts once per worker and not once per test case. - Write your test cases in
evals/. The check lines cover regexes, JSON, your own graders and a model judge.
When the API call fails for a reason that isn't your code, such as a missing key, a rate limit or a timeout, the test case couldn't run. tinyeval counts it apart from the failures, and still exits 1. The helper knows the errors of @anthropic-ai/sdk and openai. For another client, throw CouldntRun. An error in your own code fails the eval.
In an Express or other Node.js app, import your server-side function in the worker and call it there, not a route handler that needs a request. Keep logs off stdout, since stdout carries the replies. Importing tinyeval-cli before your code sends console.log to stderr.
Add ANTHROPIC_API_KEY as a repository secret. The bot and tinyeval's judge both use it. The workflow installs the packages with npm ci, then runs each test case 3 times. A failing eval fails the job, so it can gate merges. The results upload as the eval-results artifact. Without the secret, the eval step is skipped with a notice.
.github/dependabot.yml checks weekly and opens a pull request for each new version of tinyeval-cli, the SDK or an action. Those pull requests get no repository secrets, so their eval step skips with the notice. The evals run on main once you merge. To update by hand, run npm install --save-dev tinyeval-cli@latest.
A fresh CI run has no earlier run to compare with. evalship reads eval-results.json, compares each pull request with main, tells flaky evals from real drops and comments on the pull request.
MIT