Skip to content

environment variable not working #272

Answered by drptbl
syedyousafraza asked this question in Q&A
Discussion options

You must be logged in to vote

@syedyousafraza cypress.env is not process.env, so it's not working.

It's explained in the README:
https://github.com/Synthetixio/synpress#-important

You have many different options:

  1. You can use env vars as a prefix before your command, for example: ENV_VAR=VALUE synpress run
    Lets say that you have npm run test which runs synpress run. Then you can also run ENV_VAR=VALUE npm run test.
  2. You can use dotenv (check preload section):
    https://www.npmjs.com/package/dotenv
    Create new .env file with variables and then run synpress run additionally requiring your .env file.
  3. You can specify env variables with export ENV_VAR=VALUE before running tests.

.. and many more different ways. You can also r…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@dion49
Comment options

@PascalMayr
Comment options

@lucianoacsilva
Comment options

@PascalMayr
Comment options

@Loque18
Comment options

Answer selected by drptbl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants