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

Commit

Permalink
Don't test image domains in test env (vercel#26502)
Browse files Browse the repository at this point in the history
fixes vercel#21549

Co-authored-by: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
atcastle and ijjk committed Jun 22, 2021
1 parent 11dfc1f commit beb98d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/next/client/image.tsx
Expand Up @@ -703,7 +703,10 @@ function defaultLoader({
)
}

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

0 comments on commit beb98d5

Please sign in to comment.