ladjs / supertest

🕷 Super-agent driven library for testing node.js HTTP servers using a fluent API. Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.
MIT License
13.83k stars 759 forks source link

supertest call times out in travis #462

Open ravichandranjv opened 6 years ago

ravichandranjv commented 6 years ago

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

mikelax commented 6 years ago

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.

ravichandranjv commented 6 years ago

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.

jonathansamines commented 6 years ago

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

harnamc commented 4 years ago

~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.