You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Did a bit of debugging. To me, the overriding of expect is correct. It's similar enough to the code in expect-puppeteer v7 (when this used to work) that I don't think it's the culprit.
What's interesting is that when calling addSnapshotSerializer, which is just an alias for addSerializer, the PLUGINS array is updated correctly. However, when getSerializers is called later on (internally within jest somewhere), the PLUGINS array is back to its original state with only 7 elements (you'd expect there to be at least 8).
🐛 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: