Skip to content

[FEATURE]: Switch to Bun or Vitest for running tests #1378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
defaude opened this issue Sep 30, 2023 · 6 comments · Fixed by #1407
Closed

[FEATURE]: Switch to Bun or Vitest for running tests #1378

defaude opened this issue Sep 30, 2023 · 6 comments · Fixed by #1407

Comments

@defaude
Copy link
Contributor

defaude commented Sep 30, 2023

Motivation

As you might've heard, Bun has become stable just a few weeks ago. In a nutshell, it's a drop-in replacement for "classic" Node.js that promises faster startup, overall better performance etc.

What do you guys think? Should we

  • brush up & clean up the tooling overall
  • switch the JS runtime to Bun
  • update GitHub actions accordingly
  • (optional) migrate from Jest to Bun (it comes with a Jest-compatible test runner, as well)

Please add your ideas, questions and suggestions here :)

Examples

No response

Possible workarounds

No response

Additional information

No response

@defaude
Copy link
Contributor Author

defaude commented Oct 1, 2023

Alternatively, we could also say we're sticking with "vanilla" Node.js but we'll update to Node 20 (and potentially update a ton of deps and clean up the codebase a bit).

@appgurueu
Copy link
Collaborator

I'm not opposed to switching to Bun, assuming everything continues working as before, esp. if it helps improve performance (this is more of a small-ish benefit, though, at least for me as a reviewer; it may be more useful for our contributors).

A small concern is that this might make the repo slightly harder to work with for newcomers (Node.js is more common, will typically be available in your package manager / there will be easy install guides, etc.)

I also can't judge the maturity of Bun.

Updating deps & the Node version is a chore which I don't think is necessary yet (but of course I wouldn't mind it). Updating Node also may come at slight contributor inconvenience again (e.g. if the newer Node version hasn't been packaged on their distro yet).

@defaude
Copy link
Contributor Author

defaude commented Oct 1, 2023

Thanks for your insights! 🙏

I've been playing around a bit with Bun in this codebase and here are my two cents: We're not "really" using the runtime other than for executing the tests themselves and therefore might not even be benefiting from a switch to Bun at all.

We could just leave everything as-is and just run Jest with Bun instead of Node.js. In this case, there is no or just a negligible speedup. => I don't see the point in migrating just for the sake of migrating.

We could also try to migrate to using Bun's own test runner - that one is ridiculously fast. But since it's not fully supporting the API provided by Jest (at the moment), this would actually break a lot of our tests. => Absolute no-go.

I'd propose switching to vitest, instead! It's definitely more Jest-compatible and should speed up test execution quite substantially, too. If you want, I'd gladly provide a PR 😎

@defaude
Copy link
Contributor Author

defaude commented Oct 1, 2023

Especially thinking about keeping the repo to stay as newcomer-friendly as possible: Agreed that it's most likely more robust to just stick with Node / NPM and utilize awesome stuff like vitest, instead.

@defaude
Copy link
Contributor Author

defaude commented Oct 1, 2023

Regarding the version of node: Node 20 will be the "active LTS" release starting this October - see the releases page. Defining (i.e. expecting) Node 20 makes total sense. It should be easily available for everyone.

@defaude defaude changed the title [FEATURE]: Switch to Bun [FEATURE]: Switch to Bun or Vitest for running tests Oct 1, 2023
@appgurueu
Copy link
Collaborator

I'd propose switching to vitest, instead! It's definitely more Jest-compatible and should speed up test execution quite substantially, too. If you wand, I'd gladly provide a PR 😎

Sounds good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants