Skip to content

Commit

Permalink
Don't test image domains in test env
Browse files Browse the repository at this point in the history
fixes #21549
  • Loading branch information
atcastle committed Jun 22, 2021
1 parent ffaa481 commit 3f8f440
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/next/client/image.tsx
Original file line number Diff line number Diff line change
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 3f8f440

Please sign in to comment.