Background
Vite's CJS Node API is deprecated as of v5 (the current major version). Many other projects in the Vite ecosystem will likely make similar moves.
Also Vue3-Jest hasn't been updated in two years and seems end of life
Goal
Vitest is nowadays the recommended test-runner for use in the Vue ecosystem.
Codex should embrace this ESM-based future by migrating its test suite from Jest (which still only has experimental support for ES Modules) in favor of Vitest. Additionally to overcoming Jest's historically problematic ESM support:
- It promises to be API-compatible with Jest
- It reuses 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.
- Jest has slower startup due to its own transformation pipeline, see 2. above
- It also promises a watch mode that's essentially HMR but for unit tests using Vite's super-fast transformer + HMR pipeline.
Considerations
- Is Vitest sustainable choice with it's much lower market share than Vite?
@Novem_Linguae brought up this question in 2022, the 2024 stats are also available at https://raygun.com/blog/javascript-unit-testing-frameworks/#vitest
Further information
- https://vitest.dev/guide/migration.html#migrating-from-jest
- https://vitest.dev/guide/comparisons.html comparison with other frameworks including Jest
