1

We've set up Travis on our GitHub repo to test every pull request made, one test out of 73 is failing with a status code of 500 instead of having 200. The rest of the tests in the same directory are passing. Though all tests are passing locally, the issue is just on Travis.

Here are the images of the error on Travis:

This is the Travis error message

The error displays "secure" in the path which am not sure if it's supposed to be there, I think it should have been "test" cause that's the path in the repo.

Here are also the codes for the failing test:

import chai from 'chai';
import chaiHttp from 'chai-http';
import app from '../../src/index';
import { UserRole } from '../../src/database/models';

chai.should();
chai.use(chaiHttp);

describe('user role settings', () => {
  before(async () => {
    await UserRole.destroy({
      truncate: true
    });
  });
});

it('should return 200 if userRole created successfully', (done) => {
  const role = {
    name: 'TEST_MANAGER',
    description: 'This is the description test'
  };
  chai
    .request(app)
    .post('/api/role/register')
    .send(role)
    .set({ 'Accept-Language': 'en' })
    .end((err, res) => {
      if (err) done(err);
      res.should.have.status(200);
      res.body.should.be.a('object');
      done();
    });
});

I've checked the folder structure & all environments on Travis and everything seems to be in place. I've also tried increasing the timeout but nothing changed and sending the request in the test with postman and it seems to work fine, the database we're using is PostgreSQL and all migrations are working perfectly. Let me know if you need any more info. about the issue, thank you.

  • Hello there. I am facing the exact same issue. Just the part of the strange path does not apply to me. I am thinking that I might have a bad test somewhere within my unit tests, that end up breaking my integration test on Travis environment. THis is my guess. Did you manage to solve your issue? – Arp Aug 24 '21 at 12:32

0 Answers0