Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit beb98d5

Browse files
atcastleijjk
andauthored
Don't test image domains in test env (vercel#26502)
fixes vercel#21549 Co-authored-by: JJ Kasper <jj@jjsweb.site>
1 parent 11dfc1f commit beb98d5

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)