Skip to content

Commit

Permalink
chore: upgrade vitest to 3.0.6 (#9337)
Browse files Browse the repository at this point in the history
https://linear.app/unleash/issue/2-3296/upgrade-vitest

Follow-up to #9212

The ☝️ PR was failing some tests because `chartjs-adapter-date-fns` is
imported as a [side
effect](https://stackoverflow.com/questions/41127479/es6-import-for-side-effects-meaning)
and seems to be CommonJS-only. When Vitest loads it, it fails to find
named exports (like `_adapters`). By inlining `chartjs-adapter-date-fns`
in our Vitest test config, esbuild transforms it into a proper ES module
for testing.

Additionally, we’re upgrading from v1.4.0 to v3.0.6 directly since our
code seems to be fully compatible.
>Vitest requires Vite >=v5.0.0 and Node >=v18.0.0
  • Loading branch information
nunogois authored Feb 20, 2025
1 parent 9b282a4 commit 17d3f67
Show file tree
Hide file tree
Showing 3 changed files with 219 additions and 313 deletions.
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"vite-plugin-env-compatible": "2.0.1",
"vite-plugin-svgr": "3.3.0",
"vite-tsconfig-paths": "4.3.2",
"vitest": "1.4.0",
"vitest": "3.0.6",
"whatwg-fetch": "3.6.20"
},
"resolutions": {
Expand Down
5 changes: 5 additions & 0 deletions frontend/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ const vitestConfig = vitestDefineConfig({
setupFiles: 'src/setupTests.ts',
environment: 'jsdom',
exclude: [...configDefaults.exclude, '**/cypress/**'],
server: {
deps: {
inline: ['chartjs-adapter-date-fns'],
},
},
},
css: {
preprocessorOptions: {
Expand Down
Loading

0 comments on commit 17d3f67

Please sign in to comment.