node:test so you can use the integrated Node.js test runner to run evals.
Setup
Install Braintrust in your Node.js project:Run your first eval
Create a suite withinitNodeTestSuite(), then pass suite.eval() directly to test().
translation.eval.test.ts
Separate evals from unit tests
Keep eval files separate from regular unit tests with a naming convention such as*.eval.test.ts or a dedicated evals/ directory.
How it works
initNodeTestSuite()creates one Braintrust experiment for the suite.suite.eval()returns a normalnode:testcallback, so you can mix tracked evals and regular unit tests in the same file.- The callback return value becomes the logged
outputand is passed to scorers. - Passing
afterfromnode:testregisters an automatic flush hook at the end of the suite.
suite.eval(), tests run normally and are not logged to Braintrust.
Add scorers
Scorers receive{ output, expected, input, metadata } and return a score object.
autoevals: