Set up CI with Postgresql DB for test suite on Sails app

I’m trying to set up our CI to run our tests on a postgresql database. Previously we were using the sails-disk (sails app), but it is too flexible now for our testing needs.

The tests fail in the connection phase of the CI.
Running with gitlab-runner 13.0.0 (c127439c)
on docker-auto-scale 72989761
Preparing the “docker+machine” executor
00:32
Using Docker executor with image postgres …
Starting service postgres:latest …
Pulling docker image postgres:latest …
Using docker image sha256:adf2b126dda8aa62b7ab2cb10c30e0a20bad35a21570da9b4d602c9cca548a0b for postgres:latest …
Waiting for services to be up and running…
Pulling docker image postgres …
Using docker image sha256:adf2b126dda8aa62b7ab2cb10c30e0a20bad35a21570da9b4d602c9cca548a0b for postgres …
Preparing environment
00:02
Running on runner-72989761-project-12112892-concurrent-0 via runner-72989761-srm-1591107057-be3a064b…
Getting source from Git repository
00:02
$ eval “$CI_PRE_CLONE_SCRIPT”
Fetching changes…
Initialized empty Git repository in /builds/sec-spec/ems-api/.git/
Created fresh repository.
From https://gitlab.com/sec-spec/ems-api

  • [new ref] refs/pipelines/152019501 -> refs/pipelines/152019501
  • [new branch] 128-55-feat-update-expense-model-to-have-extrainfo-attribute -> origin/128-55-feat-update-expense-model-to-have-extrainfo-attribute
  • [new branch] chore/CICD -> origin/chore/CICD
  • [new branch] chore/documentation -> origin/chore/documentation
  • [new branch] chore/pin-repositories -> origin/chore/pin-repositories
  • [new branch] feat/admin-alt-email -> origin/feat/admin-alt-email
  • [new branch] feat/ccFeedError -> origin/feat/ccFeedError
  • [new branch] feat/deploy -> origin/feat/deploy
  • [new branch] feat/documentation -> origin/feat/documentation
  • [new branch] feat/email-forwarding -> origin/feat/email-forwarding
  • [new branch] feat/mileage-expense -> origin/feat/mileage-expense
  • [new branch] feat/readme -> origin/feat/readme
  • [new branch] feat/timstamps-to-dates -> origin/feat/timstamps-to-dates
  • [new branch] feat/update-date -> origin/feat/update-date
  • [new branch] feat/xmltojsoncc -> origin/feat/xmltojsoncc
  • [new branch] fix/activityProxy -> origin/fix/activityProxy
  • [new branch] fix/admin-enable-alt-email -> origin/fix/admin-enable-alt-email
  • [new branch] fix/extraInfo-bug -> origin/fix/extraInfo-bug
  • [new branch] fix/isApprover-job-code -> origin/fix/isApprover-job-code
  • [new branch] fix/mileage-image-upload -> origin/fix/mileage-image-upload
  • [new branch] fix/mileage-record -> origin/fix/mileage-record
  • [new branch] fix/resubmitSingleActivity -> origin/fix/resubmitSingleActivity
  • [new branch] fix/s3 -> origin/fix/s3
  • [new branch] master -> origin/master
  • [new branch] next -> origin/next
  • [new branch] refactor/proxySearch -> origin/refactor/proxySearch
  • [new branch] revert-412ddd1e -> origin/revert-412ddd1e
  • [new branch] revert-6753d410 -> origin/revert-6753d410
  • [new branch] wip/documentation -> origin/wip/documentation
  • [new tag] 0.0.4 -> 0.0.4
  • [new tag] 0.0.5 -> 0.0.5
  • [new tag] 0.0.6 -> 0.0.6
    Restoring cache
    00:14
    Checking cache for default-13…
    Downloading cache.zip from https://storage.googleapis.com/gitlab-com-runners-cache/project/12112892/default-13
    Successfully extracted cache
    Downloading artifacts
    00:01
    Running before_script and script
    00:02
    $ npm install
    /bin/bash: line 128: npm: command not found
    Running after_script
    00:02
    Uploading artifacts for failed job
    00:02
    ERROR: Job failed: exit code 1

Our gitlab-ci.yml:
services:
- postgres:latest

variables:
  POSTGRES_DB: $BE_TEST_DB
  POSTGRES_USER: $BE_TEST_USER
  POSTGRES_PASSWORD: $BE_TEST_PW
  POSTGRES_HOST_AUTH_METHOD: trust

connect:
  image: postgres
  script:
  - export PGPASSWORD=$POSTGRES_PASSWORD
  - psql -h "postgres" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "SELECT 'OK' AS status;"


# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
  paths:
  - node_modules/
before_script:
  - npm install
  
stages:
  - setup
  - test
  - lint
  - deploy

setup:
  stage: setup
  script: npm install

lint:
  stage: lint
  script: npm run standard

test:
  stage: test
  script: npm run test 

deploy_prod:
  stage: deploy
  script:
    - ./node_modules/.bin/now --token=4neNd1AhXjhUmeFlHmw0rlR4
    - ./node_modules/.bin/now alias --token=4neNd1AhXjhUmeFlHmw0rlR4
  environment:
    name: production
    url: ems-api.now.sh
  only:
    - master

Any help would be appreciated!