process.env not defined with test files. #26200
Unanswered
lefuncq
asked this question in
Questions and Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have an e2e test file called
ConnectWallet.cy.js
containing the following code:constants
is a file containing constants shared amongst various pages and components of my NextJS App, and some of the values there, are defined usingprocess.env
, thus raising a "Referrence Error: process is not defined" error within Cypress's test browser (The following error originated from your test code, not from Cypress.).I've been searching everywhere but couldn't find a solution that works:
cypress.config.js
will just expose my env variables toCypress.env
which I can't use withinconstants.js
sinceCypress.env
is, legitimately, undefined when running my next server.on('file:preprocessor', ...
but couldn't find how to set up the web pack so that it would "resolve/load" my process.env inside of test files.Isn't there any workaround to that issue?
Beta Was this translation helpful? Give feedback.
All reactions