GitLab CI Enviroment Variables Available in NodeJS?

One of my unit tests need to be bypassed or simply marked as a pass when in a CI enviroment (at least until I find a way to mock it). The problem I’m having is using process.env.CI does not seem to be working.

My questions are, is the GitLab CI environment variables available within the NodeJS process.env? and if not, is there a way to let NodeJS see these variables by configuring the gitlab-ci.yml or something else?

Just in case you want to see some code, repo, and pipeline, I’ll lay down some links and code for you.

The code I’m using in my unit test is as follows

  if (process.env.CI) {
    t.pass()
  }

My repo is here: https://gitlab.com/FeniXEngineMV/fenix-cli
The failed pipeline is here: https://gitlab.com/FeniXEngineMV/fenix-cli/pipelines/94768882

I appreciate any help or guidance I can get

1 Like

Hey LTNGames, did you ever figure out a solution here? I have similar needs for my project.

1 Like