Convert tests from Jest to Vitest or node-test

Open
#2,725 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Domain
frontend, testing

Research direction

Start by reviewing the linked Node.js and Open edX Paragon pull requests, then follow the discussion to determine whether Vitest or node:test will be used. Convert test folders in stages while supporting both runners, remove Jest once migration is complete, and share the resulting learnings with other MFEs.

Written by the indexing model from the issue text.

Description

good first issue help wanted

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 https://github.com/nodejs/nodejs.org/pull/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: https://github.com/openedx/paragon/pull/4043

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

Steps
  • Wait for discussion on https://github.com/openedx/paragon/pull/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
Dominant language
TypeScript
Stars
17
Forks
218
Avg merge
9d 20h
Merged PRs (30d)
20

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openedx/frontend-app-authoring

All issues in openedx/frontend-app-authoring

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.