feat(bun-test): add @effect/bun-test package#2204
Open
emilienbidet wants to merge 1 commit into
Open
Conversation
Mirrors @effect/vitest's API (it.effect, it.live, it.layer, it.prop, flakyTest) but runs under Bun's built-in bun:test runner. Closes Effect-TS/effect#5964.
🦋 Changeset detectedLatest commit: 60247dc The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Summary
Adds a new
@effect/bun-testworkspace package that mirrors the@effect/vitestAPI surface (
it.effect,it.live,it.layer,it.prop,flakyTest,layer, …) but runs on Bun's built-inbun:testrunner instead of Vitest.Companion PR to Effect-TS/effect#6236; addresses the same request as
Effect-TS/effect#5964.
Why
Quoting Effect-TS/effect#5964: Bun's test runner is significantly faster than
Vitest, and the Vitest dependency of
@effect/vitestis a thin wrapper aroundit()anddescribe()— the actual Effect test machinery (TestClock,TestConsole, fast-check integration) is runner-agnostic. This PR ports that
thin wrapper to
bun:testfor the v4 line ineffect-smol.What's in the package
packages/bun-test/mirrorspackages/vitest/:src/index.ts— public API, types, re-exports ofbun:testprimitivessrc/internal/internal.ts— Effect runner + tester/layer/prop wrappers(uses
Effect.fnUntraced,Layer.buildWithMemoMap,Layer.mergeAll(TestConsole.layer, TestClock.layer())to match the v4 vitest package shape)
src/utils.ts— assertion helpers (copied from@effect/vitestutils.ts,vassert.instanceOfswapped fornode:assert)test/index.test.ts— ported frompackages/vitest/test/index.test.tstsconfig.json,docgen.json,bunfig.toml,package.json,README.md,LICENSEA changeset is included (
.changeset/add-effect-bun-test.md).Differences from
@effect/vitestBun's test runner has a smaller surface than Vitest. The PR documents these
gaps in the package README; they were not papered over with runtime shims:
addEqualityTestersis a no-op —bun:test'sexpecthas noaddEqualityTestersAPI.TestContextis synthesised inside the test wrapper rather than passedin by the runner, because
bun:testdoesn't pass a context object.re-export from \"bun:test\"doesn't work in Bun (1.2.x), so the publicprimitives are re-exported via
constbindings rather thanexport *.Test plan
pnpm installat the workspace root resolves cleanlypnpm --filter=@effect/bun-test checkpassesbun testinsidepackages/bun-testis greenNotes for review
layer > releasetest had its trailingafterAll(...)reordered so itruns after the layer's own
afterAll(Bun runsafterAllhooks inregistration order).
it.live.fails("interrupts on timeout", ...)test from the vitest suitewas dropped because Bun has no fiber-interrupt-on-failure hook equivalent.
packages/bun-test/,.changeset/, andpnpm-lock.yamlwere touched.