-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Player does not work with jest #319
Comments
Hi @0x7u, we don't ship CJS for dotLottie-react, only ESM. You might want to check out how to mock the dotLottie-react module in Jest: https://jestjs.io/docs/ecmascript-modules#module-mocking-in-esm. By the way, which version of Jest are you using? |
Hey @theashraf, thanks for the reply. I am Jest version I've just tried the workaround you suggested it did not work for me, maybe I am not doing something right.
|
@0x7u |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. |
I was running into the same issue and mocking ended up being the key. I used this simple mock in my jest.mock('@lottiefiles/dotlottie-react', () => {
return {
DotLottieReact: () => null, // I'm not concerned with testing our animations themselves
};
}); Hopefully this helps someone else in need! |
Overview
When importing
import { DotLottieReact } from "@lottiefiles/dotlottie-react";
To use the player jest will error with this:
Consuming repo
dotlottie-web
Labels
Type: Bug
label to this issue.The text was updated successfully, but these errors were encountered: