Skip to content

Commit

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

Co-authored-by: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
atcastle and ijjk committed Jun 22, 2021
1 parent e969d22 commit 325b3a9
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 325b3a9

Please sign in to comment.