ROX-33205: Upgrade vitest 4.1.0 by pedrottimark · Pull Request #19462 · stackrox/stackrox
Description
https://vitest.dev/blog/vitest-4
https://vitest.dev/guide/migration
Vitest 4.0 requires Vite >= 6.0.0 and Node.js >= 20.0.0.
https://vitest.dev/guide/migration.html#simplified-exclude
By default, Vitest now only excludes tests from
node_modulesand.gitfolders.
This means that Vitest no longer excludes:
distandcypressfolders.idea,.cache,.output,.tempfolders- config files like
rollup.config.js,prettier.config.js,ava.config.jsand so on
If you need to limit the directory where your tests files are located, use the
test.diroption instead because it is more performant than excluding files
eslint-plugin-vitest
https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-conditional-expect.md
This rule aims to prevent false positive test results by highlighting conditional expect statements.
That is, if conditional is incorrect, I guess.
Add ESLint disable comment, because false positive does not seem like a risk.
plugin-react
TL;DR Upgrade to 5.2.0 because it supports, but does not require, vite 8.
https://github.com/vitejs/vite-plugin-react/releases/tag/plugin-react%406.0.0
Vite 7 and below are no longer supported. If you are using Vite 7, please upgrade to Vite 8.
https://github.com/vitejs/vite-plugin-react/releases/tag/plugin-react%405.2.0
This plugin is compatible with Vite 8.
https://github.com/vitejs/vite-plugin-react/releases/tag/plugin-react%405.0.0
This plugin now requires Node 20.19+ or 22.12+.
Procedure
-
npm outdatedin ui/apps/platform folder. -
Visit npmjs.com for outdated vitest and related dependencies
@testing-library/…@vitest/…
-
Click Repository link, and then read either of the following:
- Releases
- CHANGELOG.md
User-facing documentation
- CHANGELOG.md update is not needed
- documentation PR is not needed
Testing and quality
- the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
- CI results are inspected
Automated testing
- edited unit tests
- added e2e tests
- added regression tests
- added compatibility tests
- modified existing tests
How I validated my change
npm run tscin ui/apps/platform folder.npm run lint:fast-devin ui/apps/platform folder.npm run testin ui/apps/platform folder.
Same counts before and after upgrade:
Test Files 122 passed (122)
Tests 1316 passed | 2 skipped (1318)