Skip to content

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

Description

@defaude

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

Activity

  1. defaude commented on Oct 1, 2023

    @defaude
    ContributorAuthor

    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).

  2. appgurueu commented on Oct 1, 2023

    @appgurueu
    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).

  3. defaude commented on Oct 1, 2023

    @defaude
    ContributorAuthor

    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 😎

  4. defaude commented on Oct 1, 2023

    @defaude
    ContributorAuthor

    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.

  5. defaude commented on Oct 1, 2023

    @defaude
    ContributorAuthor

    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.

  6. changed the title [-][FEATURE]: Switch to Bun[/-] [+][FEATURE]: Switch to Bun or Vitest for running tests[/+] on Oct 1, 2023
  7. appgurueu commented on Oct 1, 2023

    @appgurueu
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions