feat: Add bun test runner integration#1486
Closed
Abhijeet Prasad (AbhiPrasad) wants to merge 2 commits intomainfrom
Closed
feat: Add bun test runner integration#1486Abhijeet Prasad (AbhiPrasad) wants to merge 2 commits intomainfrom
Abhijeet Prasad (AbhiPrasad) wants to merge 2 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves #1479
AI Summary
Adds
initBunTestSuite— a Braintrust experiment integration for Bun's built-in test runner. Eachsuite.test()call registers a realbun:testtest that logs inputs, outputs, and scorer results as experiment spans.Usage
Data expansion uses loops, and all bun:test modifiers are supported:
How it differs from
wrapVitestandinitNodeTestSuiteAll three integrations share the same core (
EvalConfig,ScorerFunction,runTracedEval) but adapt to each runner's API:wrapVitestinitNodeTestSuiteinitBunTestSuitebt.test(name, config, fn)test(name, suite.eval(config, fn))suite.test(name, config, fn)node:testlogOutputs,logFeedback,expectwrapperinitBunTestSuiteuses thesuite.test(name, config, fn)shape because bun callbacks don't receive a context with.name— the test name must be captured at registration. This also makes modifier wrapping natural (suite.test.skip(...),suite.test.if(cond)(...)).The
testconfig parameter is generic (BunTestSuiteConfig<TTest>) so bun's actualTest<[]>type is forwarded without the SDK depending on bun's types. A runtimevalidateTestFunction()catches misconfiguration early. Modifiers like.onlyare bound lazily because bun's CI mode throws whentest.onlyis even property-read.Future extensions
test.each()support for more ergonomic parameterized testssuite.test()wrapperslogOutputs/logFeedbackhelpers for parity with the vitest integrationcreateTracedEvalFnto reduce duplication across runner integrations