Skip to content

Convert tests from Jest to Vitest or node-test #2725

@bradenmacdonald

Description

@bradenmacdonald

Node's built-in test runner which has been stable since Node 20, has most of the same features as Jest, runs tests faster, supports ESM, and doesn't take up any space nor add any dependencies, unlike Jest which is quite bloated - 512 dependencies and 68 MB disk just for jest@30.0.5.

This PR nodejs/nodejs.org#7623 is a good example of what such a conversion looks like and shows things like how to setup jsdom with node:test.

This PR shows how to do it in one of our repos: openedx/paragon#4043

Discussion: https://openedx.slack.com/archives/C04BM6YC7A6/p1756171002718889

Steps

  • Wait for discussion on refactor: run tests with vitest paragon#4043 to see if we'll go with Vitest or node:test
  • Update this repo so that some tests can run using Jest and others using a new test runner
  • Convert "chunks" of tests from Jest to Vitest/node-test, e.g. pick a folder and convert all the tests in that folder. Repeat.
  • Remove Jest
  • Share learnings with other MFEs

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueA good task for a newcomer to start withhelp wantedReady to be picked up by anyone in the community

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions