CImrie / mongomem

In-memory MongoDB Server. Ideal for testing.
58 stars 7 forks source link

fix(ava-test): prevent port is listened issue in ava test #5

Closed jyungtong closed 4 years ago

CImrie commented 7 years ago

Hey - thanks for this.

Can you explain the issue it is fixing? Can you also explain why removing the server port from the getport() function fixes the issue?

I believe the get-port library searches for the first available port. If you supply an argument (e.g. '27017') then it tries that port. If it is taken it moves on to the next one. I'm just wondering how this fixes anything, rather than simply starting from a different port.

Thanks in advance!

jyungtong commented 7 years ago

@CImrie When I was testing with multiple test files with AVA, AVA will spawn multiple instance of mongoDB. But this will cause multiple mongoDB listening on the same port 27017 and causing port is used issue.

So I removed the default port, and let the listening port to be randomised, so that multiple mongoDB instance won't crashed in parallel testing.