Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

362
Views
Lottie mocking is not working in react-testing-library

When I tried to run test cases I am getting the following error:

TypeError: Cannot set property 'fillStyle' of null
for line: import Lottie from 'react-lottie';

Can someone please help how to mock this library? I have also added 'jest-canvas-mock' library and added the below configuration in the jest.config.ts:

import type { Config } from '@jest/types';

// Sync object
const config: Config.InitialOptions = {
  verbose: true,
  setupFiles: ['jest-canvas-mock']
};
export default config;

Versions of the packages used:

react: 17.0.2
react-testing-library: 11.2.7
react-lottie: 1.2.3
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!