Skip to content

Commit 6a543d6

Browse files
mock framer-motion to fix jest unit test fails (#2362)
1 parent d684e1f commit 6a543d6

File tree

3 files changed

+493
-515
lines changed

3 files changed

+493
-515
lines changed

frontend/jest.setup.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ if (typeof global.fetch === 'undefined') {
2727
} as Response)
2828
}
2929

30+
// Mock framer-motion due to how Jest 30 ESM resolution treats
31+
// motion-dom's internal .mjs imports as "outside test scope".
32+
jest.mock('framer-motion', () => {
33+
return {
34+
...jest.requireActual('framer-motion'),
35+
LazyMotion: ({ children }) => children,
36+
}
37+
})
38+
3039
jest.mock('next-auth/react', () => {
3140
return {
3241
...jest.requireActual('next-auth/react'),

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"@tailwindcss/postcss": "^4.1.14",
8282
"@testing-library/jest-dom": "^6.9.1",
8383
"@testing-library/react": "^16.3.0",
84-
"@types/jest": "^29.5.14",
84+
"@types/jest": "^30.0.0",
8585
"@types/leaflet": "^1.9.20",
8686
"@types/leaflet.markercluster": "^1.5.6",
8787
"@types/markdown-it": "^14.1.2",
@@ -103,7 +103,7 @@
103103
"globals": "^16.4.0",
104104
"identity-obj-proxy": "^3.0.0",
105105
"import-in-the-middle": "^1.14.4",
106-
"jest": "^29.7.0",
106+
"jest": "^30.2.0",
107107
"jest-axe": "^10.0.0",
108108
"jest-environment-jsdom": "^30.2.0",
109109
"open": "^10.2.0",

0 commit comments

Comments
 (0)