Property-based testing support in bun:test (fast-check integration, or Bun's own take) #43990
LewisAlderman
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I use fast-check for property-based testing and would love to run it through
bun testproperly. Vitest and Jest both have official integrations (@fast-check/vitest,@fast-check/jest) that addtest.prop([...arbitraries])('name', fn). Neither works withbun:test, and fast-check's docs say there's no Bun connector, which is why I'm writing this.Calling
fc.assert(fc.property(...))inside a normaltest()works fine today, so nothing is blocked. The gaps are the things only a test runner can do:bun test --seedshuffles test order but doesn't reach fast-check, so one seed can't reproduce a whole run.interruptAfterTimeLimityourself.I don't have strong opinions on the shape. It could be
test.propbuilt on fast-check as a peer dependency, maybe using the plugin API fast-check added in 4.10. Or Bun could build its own version, which might allow things a library can't do, like using JSC's coverage data to guide which inputs get generated.In theory you could get most of the way there with a small
prop()wrapper aroundfc.assertplusfc.configureGlobalin a preload file, or by running Vitest under Bun instead. Both would work, but neither can do the runner-level parts above.Curious whether this is something the team would consider.
All reactions