visionmedia / expresso

use mocha
http://visionmedia.github.com/expresso
759 stars 89 forks source link

expresso hangs...assert.response #134

Open gitfy opened 13 years ago

gitfy commented 13 years ago

Hi, All my tests are based on assert.response. But for some reason, the expresso command never gracefully shutdown with results.

After executing all the tests, it kind of hangs. Don't know whether, something has to be done in the last test to trigger a shutdown.

When i do a CRTL-C, it exits with 100%.

What might be the issue here ?

Any help.

Thanks.

kkaefer commented 13 years ago

This could be because of something else in your code that prevents node from exiting. setTimeout/setInterval or IO such as open network connections or file streams keep the node process running. Unfortunately, I'm not aware of a good way to find out what is preventing node from exiting.

cwu commented 13 years ago

I'm suffering from the same issues (probably from open redis clients). Where would there be a good place to close these open network connections?

kkaefer commented 13 years ago

@cwu, I'm not aware of a good place to do this :( Expresso needs a way for tests to signal that they completed so that it could run a shutdown function. However, there currently isn't such a facility.

ericsorenson commented 13 years ago

I'm having the same problem stemming from mongoose.js connections to MongoDB. Everything hangs until I send a CRTL-C.

pschumi commented 13 years ago

setTimeout(function() { process.exit(0) }, 1000*numSecs); seems to work (added as a test case) but it's quite a dirty solution. Adding clean connection close doesn't help.

I think that nodejs checks reserved resources at some point (I guess when the last function is called not counting callbacks) but if it cannot exit the check isn't done anymore. So there is hiding bug...or should we call it as feature? :) Anyway it seems that the problem isn't expresso it's nodejs.

You can try to write NodeJS script with i.e. MongoDB functionality and there is the same problem.

Have anyone tested this with 0.6.x?