From dc5da878a714a341fef04a2b2e77e2e2ba4b9b24 Mon Sep 17 00:00:00 2001 From: Neil van Beinum Date: Tue, 19 Jan 2021 16:38:05 +0000 Subject: [PATCH] Load Jest test environment with .env.sample vars Next isn't instantiated by Jest, so we need to explicitly tell it where to get env vars. Using .env.sample as I don't see a need for more specialised .env.test or other file for our values which are all test strings. https://github.com/vercel/next.js/pull/16443 --- setupTests.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setupTests.js b/setupTests.js index 264828a90..e748653c2 100644 --- a/setupTests.js +++ b/setupTests.js @@ -1 +1,4 @@ import '@testing-library/jest-dom/extend-expect' + +import dotenv from 'dotenv' +dotenv.config({ path: '.env.sample' })