From 53bc5b3dd326d70da5b8b3d5cd48355b649ffe75 Mon Sep 17 00:00:00 2001 From: Steven Date: Wed, 13 Jul 2022 15:45:09 -0400 Subject: [PATCH] Fix `next/jest` when testing `next/future/image` (#38569) - Fixes #38383 - Similar to a previous fix in #26502 --- packages/next/client/future/image.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/next/client/future/image.tsx b/packages/next/client/future/image.tsx index 38eb0dd47563..1c62dc641e0f 100644 --- a/packages/next/client/future/image.tsx +++ b/packages/next/client/future/image.tsx @@ -301,7 +301,7 @@ export default function Image({ blurDataURL, ...all }: ImageProps) { - if (!experimentalFuture) { + if (!experimentalFuture && process.env.NODE_ENV !== 'test') { throw new Error( `The "next/future/image" component is experimental and may be subject to breaking changes. To enable this experiment, please include \`experimental: { images: { allowFutureImage: true } }\` in your next.config.js file.` )