supertest icon indicating copy to clipboard operation
supertest copied to clipboard

supertest call times out in travis

Open ravichandranjv opened this issue 7 years ago • 4 comments

Local build with the cloned repository passes but travis build fails.

The supertest request().get call to a node js server.js express route times out while the same test works perfectly in the local environment.

The only difference between the travis and the local environment is the supertest package. The travis.yml script npm installs supertest each time the build is triggered while in the local environment, the supertest package is as it was when I installed it last year!

Uploading node modules folder to the repo and removing the npm install from the before script in travis.yml also did not work.

Is it possible that the supertest npm install breaks when travis tries to install it or it installs it in some container that causes a delay and therefore times out? Why would the test timeout otherwise?

image

ravichandranjv avatar Feb 17 '18 05:02 ravichandranjv

If you are using a version from a year ago, are you sure the versions of supertest are the same? The error in your screenshot implies you are performing an async test, but are not calling the done function to complete the promise.

mikelax avatar May 14 '18 15:05 mikelax

That is why I mentioned the first line as build passed, locally. Yes, it is an async test and done is called, to reiterate the same code/test passes locally.

ravichandranjv avatar May 25 '18 18:05 ravichandranjv

@ravichandranjv what is your test trying to achieve? Knowing that could help debugging this issue

jonathansamines avatar Aug 15 '18 05:08 jonathansamines

~Hi @ravichandranjv, We are facing the same issue on this using version 4.0.2. Did you manage to solve the issue or at least find the root cause?~

For us the issue was mocha. It was updated to latest version and started running tests in a different order. The 1st test we needed to run was to set up the local server (I know its bad way to do unit tests) so the other tests and use http://localhost to run the tests.

harnamc avatar Jun 27 '20 22:06 harnamc