Page MenuHomePhabricator

Consider migrating from Jest to Vitest
Open, LowestPublic

Description

Vitest is a relatively new testing framework, and now the recommended one for use in the Vue ecosystem. It promises to be API-compatible with Jest, while reusing the Vite config. This could allow us to deduplicate some configuration and transforms (in particular the SVG transform in the icons package), because we wouldn't have to have a separate version of those for Jest anymore. Vitest also promises a watch mode that's essentially HMR but for unit tests.

Event Timeline

Vitest doesn't appear to have much market share. It looks like as of 2022 it was rated 11th most popular, if this is accurate.

Jest of course is the # 1 most popular outside of the mediawiki ecosystem.

I would argue that there are some good advantages to preferring "popular" software such as Jest:

  • ease of onboarding (the software engineer might already know it)
  • more frequent library patches
  • doesn't become abandonware as quickly

Whatever is decided here, I just wanted to point this out. QUnit has low market share and so does Vitest. Jest might be an opportunity for mediawiki to standardize around more popular JS testing software, which could be a technical debt win in the long run.

Vitest doesn't appear to have much market share. It looks like as of 2022 it was rated 11th most popular, if this is accurate.

Jest of course is the # 1 most popular outside of the mediawiki ecosystem.

I would argue that there are some good advantages to preferring "popular" software such as Jest:

  • ease of onboarding (the software engineer might already know it)
  • more frequent library patches
  • doesn't become abandonware as quickly

Whatever is decided here, I just wanted to point this out. QUnit has low market share and so does Vitest. Jest might be an opportunity for mediawiki to standardize around more popular JS testing software, which could be a technical debt win in the long run.

Popularity is often a good consideration when evaluating a framework, but for me the most important thing here is that Vitest is the recommended framework for Vue, which is what we're using. For Jest in particular, the Vue docs say:

However, we only recommend Jest if you have an existing Jest test suite that needs to be migrated over to a Vite-based project, as Vitest offers a more seamless integration and better performance.