@b4run/testing
v0.14.0
Published
Deterministic harnesses, fixtures, and matchers for testing B4.run agent applications.
Downloads
4,694
Maintainers
Readme
@b4run/testing
Supported harnesses, fixtures, matchers, deterministic embedders, and runtime helpers for testing B4.run applications.
Use this when: You want to test B4.run agent behavior without making live model calls.
Install
pnpm add -D @b4run/testing vitestExample
import { createAgentHarness, expectFinalMessage, script } from "@b4run/testing"
await using harness = await createAgentHarness({
appRoot: process.cwd(),
route: "/support#agent",
})
const result = await harness.run({
input: "Say hello",
fixtures: script().user("Say hello").replies("Hello!"),
})
expectFinalMessage(result).toContain("Hello")Runtime and stability
@b4run/testing is a supported node-only testing surface. createAgentHarness() temporarily changes process-wide model environment variables and runtime caches; await close() and do not run concurrent harnesses in one process. Fixture replay is deterministic and CI-safe; live recording requires model credentials.
Related
- Testing API reference — exact harness and lifecycle contracts.
- Agent Test Harness — end-to-end agent testing.
- Fixtures and Recording — deterministic replay and optional live recording.
@b4run/evals— repeatable datasets, scorers, and release gates.
Maturity and support
B4.run is pre-1.0, and its public surface can change. All publishable B4.run packages release together as a fixed group; review the @b4run/testing changelog and upgrading guide before upgrading. For support, use GitHub Discussions; report defects in GitHub Issues.
License
MIT. See the repository license.
