HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
🧚
[1기]최종 프로젝트 데브코스
/
[팀7] 뿡치와 삼촌들 - Devnity
[팀7] 뿡치와 삼촌들 - Devnity
/
📘
프론트엔드 공간
/
🧑‍🎓
Today We Learned
/
Lottie 사용시 Jest 에러 해결방법

Lottie 사용시 Jest 에러 해결방법

생성일
Dec 12, 2021 04:20 PM
기록자
Jay Mincheol Cho
해결 여부
해결 여부
속성
카테고리

해결 방법

yarn add --dev jest-canvas-mock
jest.config.js:
module.exports = { preset: "ts-jest", testEnvironment: "jsdom", setupFilesAfterEnv: [ "@testing-library/jest-dom/extend-expect", "jest-plugin-context/setup", "jest-canvas-mock", // 추가 ], testPathIgnorePatterns: ["<rootDir>/node_modules/", "<rootDir>/dist/"], moduleNameMapper: { "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js", "\\.(css|less|scss|sass)$": "identity-obj-proxy", }, };

See also

  • https://robertmarshall.dev/blog/react-jest-tests-failing-using-lottie-js-solved/