-
Notifications
You must be signed in to change notification settings - Fork 288
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 serializers added with expect.addSnapshotSerializer
are not used
#552
Comments
Hello @askoufis, thanks. I think it is a problem in the overriding of |
Did a bit of debugging. To me, the overriding of What's interesting is that when calling |
Thanks for the fix! :) |
🐛 Bug Report
Custom snapshot serializers added with
expect.addSnapshotSerializer
are not used. Only custom snapshots serializers configured viasnapshotSerializers
actually work.This behaviour appears to have broken in version 8.
To Reproduce
git clone https://github.com/askoufis/jest-puppeteer-repro
pnpm install
pnpm test
The test in
foo.test.js
is run. This has a custom serializer added that prepends some text to the snapshot. However the snapshot does not contain this test, which is a bug.git switch jest-puppeteer-7
pnpm install
pnpm test
This branch has
jest-puppeter@7
installed. The snapshot serializer works in this case.git switch config-snapshot-serializers
pnpm install
pnpm test
This branch has the snapshot serializer configured in the jest config instead of the test file, and it's using
jest-puppeteer@8
. The snapshot now fails as the serializer has prepended some text to the snapshot, which is the expected behaviour.Expected behavior
Custom snapshot serializers added with
expect.addSnapshotSerializer
should work.Link to repl or repo (highly encouraged)
https://github.com/askoufis/jest-puppeteer-repro
System info
Paste the results here:
The text was updated successfully, but these errors were encountered: