-
Notifications
You must be signed in to change notification settings - Fork 309
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
Snapshot testing agains fixture triggers an error #202
Comments
@thymikee any thoughts on that? |
Not quite. cc @ahnpnl |
hmm I never experience this issue. Can you try to use
with
|
As I said before: |
I'm also running into the same issue. If it helps, I am using NX and the |
Does it also occur, when just that one test case is run? If so, a minimal reproduction would be very helpful. It can also be a minimal nrwl project. If the component is quite big, try to cut it down to an error reproducing, but minimal size. Does it only happen in watch mode? |
I think I found a solution, at least for my case. After running my tests with the debug flag, I noticed the snapshotSerializers array was empty. Adding the following to my jest config solved the issue.
|
The jest config at the workspace root should not contain snapshot serializers, but the one for the app level should have the serializer array you posted by default. Just verified it with a newly generated nrwl app. So it seems you had a different issue. |
@blackholegalaxy have you figured out the solution for your issue ? Does it still occur ? |
We observe OutOfMem in angular while using toMatchSnapshot() on a page. Can it be related to jestjs/jest#9980 ? |
can be, |
Close as cannot reproduce the issue without a repo. If you are still having the issue, please provide a repo. |
When snapshot testing a component, we encountered an error:
Tested component
global-loader.component.ts
Testing files
translate-pipe.mock
global-loader.component.spec.ts
Sometimes it even produces a memory error and stops
jest --watch
Useful information
expect(fixture.debugElement.nativeElement).toMatchSnapshot();
worksexpect(component).toMatchSnapshot();
worksDependencies
We tried to add Prettier and use
toMatchInlineSnapshot
without more success.The text was updated successfully, but these errors were encountered: