Travis variables not available in node.js

I’m setting up travis environment variables both using console and travis.yml, so when I’m running build on travis all variables are exported, e.g.

enter image description here

Variables I’ve set in console are accessible from travis script, since docker containers built are deployed to docker and code is pushed to AWS.

Problem I have is to access these variables from node.js tests that I’m running from the script:

before_install:
  - docker build -t mydocker/api-test -f ./server/Dockerfile.dev ./server

script:
  - docker run -e CI=true mydocker/api-test npm test

When I try to access those variables using process.env.TEST_ENV or process.env.TEST_VAR or any other, I’m getting undefined.

I’m using this script to run tests from node:

"test": "NODE_ENV=test nyc --reporter=html mocha --timeout 10000 "src/**/*.test.js" --require @babel/polyfill --require @babel/register --recursive --exit",

Source: Docker Questions