rsnext/packages/next/build/jest/__mocks__
Balázs Orbán 2060d0e3e9
fix(image): don't show placeholder warning in Jest (#41329)
In Jest, we were mocking the `next/image` imports with a width and
height of `24`. If the developer set `placeholder="blur"` on their
images though, this triggered the warning:

> Image with src "/img.jpg" is smaller than 40x40. Consider removing the
"placeholder='blur'" property to improve performance.

Since we cannot reliably hide this warning without knowing the actual
image dimensions, and we also provide a `blurDataURL` by default, we
should increase the mock image size to suppress the warning.

Note that using `moduleNameMapper` in `jest.config.js`, the developer
can already tweak the mock behavior:


a78163dc61/packages/next/build/jest/jest.ts (L111-L121)

Fixes #41248
2022-10-11 16:06:54 +02:00
..
fileMock.js fix(image): don't show placeholder warning in Jest (#41329) 2022-10-11 16:06:54 +02:00
styleMock.js Experimental next/jest config helper (#31246) 2021-11-10 16:16:15 -08:00