Read CircleCI Environment Variables in JS Testing Code

javascript
nodejs
envars
circle.yml

#1

I’ve integrated Circle CI into a GitHub repo. I have been able to figure out how to specify which version of node to use as well as how to create my Postgres DB before running my migrations, seeds and tests. The issue I am running into now is that my Javascript files cannot read the environmental variables I have set via Circle CI’s UI.

I have this line of code at the top of one of my test.js files:

const authToken = process.env.AUTH_TOKEN;

where the AUTH_TOKEN variable is set in my Circle CI settings.

I have looked around this forum and the internet in general, but cannot seem to find the answer to this problem.

Any help is greatly appreciated. Thanks in advance.


#2