All my test pass localy but fail on travisCI, I'm using mocha, supertest, nyc

I’m setting up a reful api in nodejs, the first part was to set it with data strucutre and all test were running right good localy and on travis but now I’m using posgresql and I’ve add some instructions in my .travis.yml… find it below

language: node_js
node_js:
 - "stable"

services:
  - postgresql
addons:
  postgresql: "10"
  apt:
    packages:
      - postgresql-10
      - postgresql-client-10
env:
  global:
    - PGPORT=5432
    - DB_NAME=questioner
    - DB_USER=jaman
before_script:
  - psql --command="CREATE USER ${DB_USER};"
  - psql --command="CREATE DATABASE ${DB_NAME} WITH OWNER = ${DB_USER};"

connection instructions are gathered in one file, here it is

const pg = require('pg');

const config = {
  user: 'jaman',
  database: 'questioner',
  password: '123',
  port: 5432
};
const pool = new pg.Pool(config);

module.exports = pool;

This connection is imported in user.js and userTest.js respectivly below

const express = require('express');
const pool = require('./connection');


const router = express.Router();


router.get('/', (req, res, next) => {
  pool.query('SELECT * FROM users', (err, result) => {
    if (err) {
      throw err;
    }
    res.status(200).json({
      status: 200,
      data: result.rows
    });
  });
});

router.get('/:userId', (req, res, next) => {
  const userId = parseInt(req.params.userId, 10); 
  pool.query('SELECT * FROM users WHERE id_user = $1', [userId], (err, result) => {
    if (err) {
      throw err;
    }
    res.status(200).json({
      status: 200,
      data: result.rows
    });
  });
});

router.post('/', (req, res, next) => {
  const {
    firstname, lastname, othername, email, phonenumber, username, registered, isadmin
  } = req.body;

  pool.query('INSERT INTO users (firstname, lastname, othername, email, phonenumber, username, registered, isadmin) VALUES ($1,$2,$3,$4,$5,$6,$7,$8)', [firstname, lastname, othername, email, phonenumber, username, registered, isadmin], (err, results) => {
    if (err) {
      throw err;
    } else {
      res.status(201).json({
        status: 201,
        data: [req.body]
      });
    }
  });
});

router.patch('/:userId', (req, res, next) => {
  const userId = parseInt(req.params.userId, 10);

  const { firstname, lastname, othername } = req.body;

  pool.query(
    'UPDATE users SET firstname = $1, lastname = $2, othername = $3 WHERE id_user = $4',
    [firstname, lastname, othername, userId],
    (err, results) => {
      if (err) {
        throw err;
      }
      res.status(200).json({
        status: 200,
        data: [req.body]
      });
    }
  );
});
router.delete('/:userId', (req, res, next) => {
  const userId = parseInt(req.params.userId, 10);

  pool.query('DELETE FROM users WHERE id_user = $1', [userId], (err, results) => {
    if (err) {
      throw err;
    }

    res.status(200).json({
      status: 200,
      data: `User deleted with ID: ${userId}`
    });
  });
});
module.exports = router;

end the test file

/* eslint-disable consistent-return */
/* eslint-disable no-undef */
// eslint-disable-next-line
const assert = require('chai').assert;
const request = require('supertest');
const app = require('../app');
const connection = require('../api/routes/connection');

describe('Testing user endpoints', () => {
  describe('All users', () => {
    it('All users', (done) => {
      request(app)
        .get('/users')
        .set('Accept', 'application/json')
        .expect('Content-Type', /json/)
        .expect(200, done);
    });
  });
  describe('Find a specific user', () => {
    it('Get a specific user', (done) => {
      request(app)
        .get('/users/1')
        .set('Accept', 'application/json')
        .expect('Content-Type', /json/)
        .expect(200, done);
    });
  });
  
  describe('Post user', () => {
    const user = {
      id: 1,
      firstname: 'Emmanuel',
      lastname: 'Bush',
      othername: 'King',
      email: 'emabush@gmail.com',
      phonenumber: '+250789813478',
      username: 'EmaBush',
      registered: '2018-02-16',
      isAdmin: true
    };
    it('Create a user', (done) => {
      request(app)
        .post('/users')
        .send(user)
        .set('Accept', 'application/json')
        .expect(201)
        .end((err) => {
          if (err) return done(err);
          done();
        });
    });
  });

  describe('udpate user', () => {
    it('Updated user', (done) => {
      request(app)
        .patch('/users/1')
        .set('Accept', 'application/json')
        .expect('Content-Type', /json/)
        .expect(200, done);
    });
  });

  describe('Delete user', () => {
    it('Deleted user', (done) => {
      request(app)
        .delete('/users/1')
        .set('Accept', 'application/json')
        .expect('Content-Type', /json/)
        .expect(200, done);
    });
  });
});

when I run localy npm test i get the following result

but when I push up all my files on github travis throws the following error

for good preview find below the screen shot of travis error

need help plz… thx in advance

Hey there,

I could very well be mistaken but I believe the error is a SQL error. More exactly, it looks like you aren’t creating the users table anywhere?