Skip to content

Commit 3f8f440

Browse files
committed
Don't test image domains in test env
fixes #21549
1 parent ffaa481 commit 3f8f440

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/next/client/image.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,10 @@ function defaultLoader({
703703
)
704704
}
705705

706-
if (!configDomains.includes(parsedSrc.hostname)) {
706+
if (
707+
process.env.NODE_ENV !== 'test' &&
708+
!configDomains.includes(parsedSrc.hostname)
709+
) {
707710
throw new Error(
708711
`Invalid src prop (${src}) on \`next/image\`, hostname "${parsedSrc.hostname}" is not configured under images in your \`next.config.js\`\n` +
709712
`See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host`

0 commit comments

Comments
 (0)