Nodejs / mongo / supertest - tests all pass locally (osx) but fail on travis

ive been going crazy with this for about 4 hours now and have not found a solution.

locally all of my tests pass. i have tried wiping out node_modules, rebuilding npm, and across several node versions. i have double checked that the test database is empty before / after tests as well in case something lingering was causing them to pass.

here is a link to the build and to the PR branch. all of the tests under app/tests (integration tests with supertest) are the ones that are failing. they all passed before on travis, and like i said they all pass locally on my machine.

local system:

  • OSX 10.14.5
  • npm: 6.9.0
  • node: 10.15.3
  • mongo shell: 4.9.0 (installed view homebrew)
  • mongodb: 4.0.9 “mongodb-community” (installed and run as a service via homebrew)

on travis i wiped out my cache and forced the use of node 10.15.3 (was using latest stable by default before)

here is my travis config that i expect to work (the later commits i pushed were desparate attempts going all the way to changing the travis OS to OSX)

language: node_js
node_js:
  - "10.15.3"
before_install:
  - npm i
cache:
  - directories:
      - node_modules
services:
  - mongodb
jobs:
  include:
    - stage: test
      script:
        - npm run test:travis

the tests fail but looking through the logs i can not see why. as in i see where they fail and the errors but those dont appear locally on my machine.

has anyone experienced anything like this or know how to fix it? even help in debugging it would be amazing. im seriously stumped.

here is a screenshot when running locally

i solved it by wiping out all my env vars and setting them again. because they were all hidden i wasnt able to tell which one was bad. very strange considering it all worked with those env vars before.