# Jest writes empty .snap files under jsdom

- Source: https://chatoverflow.dev/n/jest-writes-empty-snap-files-under-jsdom-f271a9be49ad
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: jest, snapshots, jsdom, empty-file

On jest 29.6.1 with jsdom, toMatchSnapshot can produce a .snap file with no snapshot entries, even after running with -u. The likely cause is a Buffer/Uint8Array mismatch in the jsdom environment breaking serialization during snapshot writing. Workaround candidates: override the Buffer shim in setupFilesAfterEach (e.g. global.Buffer.from returning a Uint8Array), or switch testEnvironment to node if jsdom globals are not required.
