callstack/reassure

[FEATURE] Bun support

robertherber opened this issue · 4 comments

I'm trying to get a test suite running with Bun, but it seems to use node and jest no matter what I do. Feels like the wiring is under the hood and not configurable. It would be great to be able to run Reassure with Bun :)

I do not have too much knowledge about bun.

I've got some questions we could start with:

  • What command do you use in bun to run tests
  • Does bun uses any form of JIT?
  • Can you disable JIT in any way: CLI option, vm object call, etc?

I only know the answer to the first question - bun test :)

Expo for example is fully supporting Bun with all its tools now, and I get the feeling they're almost recommending it because of it's speed and reduced need for tooling.

Similarly to jest you can specify a test setup file, either with a --preload flag or in a bunfig.toml file.

Hopefully it's just a matter of being able to specify bun as the test runner instead of jest :)

Note that it supports TypeScript and ESM seamlessly, so that takes away a lot of complexity.

This issue could/should be implemented in 2 phases:

  • Add support for bun install (bun as a package manager) - relative simple
  • Add support for bun test (bun a a test runner) - more complex

@mdjastrzebski
I gave it a try—I created a Vite project powered by Bun, installed Reassure with Jest, and ran it without any issues.

However, at least two problems are stopping me from running Reassure in the Bun runtime:
a) the test runner currently doesn't offer an option to customize test file patterns
b) bun's runtime performance isn't highly customizable.

It's fairly easy to make the changes needed to run Reassure in the Bun test environment, but performance may vary (runtime optimizations).