diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 114de2ec801805a14f23c0010dfbdf69a2b87732..01b970de991ece903a651f4f59ecbc8df6ec7a31 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,6 +8,9 @@ services:
   - postgres
 
 variables:
+  POSTGRES_DB: sigma_staging
+  POSTGRES_USER: sigma
+  POSTGRES_PASSWORD: "sigma_pw"
 
 # This folder is cached between builds
 cache:
@@ -24,8 +27,6 @@ stages:
 # Install dependencies, compile the bundle.js,
 build:transpile:
   stage: build
-  before_script:
-    - export NODE_ENV=staging
   script:
     - npm ci 
     - npm run build
@@ -33,9 +34,15 @@ build:transpile:
     paths:
       - build/
 
-tests:
+tests:mocha:
   stage: tests
   script:
+    - npm ci
     - echo '{"dn":"dn", "passwd":"passwd"}' >> ldap_credentials.json
-    - npm i
+    - export TARGET_ENV=staging
+    - export DB_HOST=postgres
+    - cd db
+    - knex migrate:latest --env staging
+    - knex seed:run --env staging
+    - cd ..
     - npm run test
\ No newline at end of file