You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm thinking about using this repo for testing and I've encountered a problem in Jest.
If I start tests by defining a postgres mock, by PostgresMock.create() then .listen() and later at the end of the tests end it with .destroy() (I don't think there's any other way to do it), then when I run the tests again (without ending the process) I get a message that the port is taken.
I reviewed the code and it seems to me that the problem is the server created in listen(), which is not closed by destroy().
My solution is to save the created server in some private variable and in the destroy() method end it with .close();.
I tested it locally and the solution releases the port, eliminating the problem.
The text was updated successfully, but these errors were encountered:
I'm thinking about using this repo for testing and I've encountered a problem in Jest.
If I start tests by defining a postgres mock, by
PostgresMock.create()
then.listen()
and later at the end of the tests end it with.destroy()
(I don't think there's any other way to do it), then when I run the tests again (without ending the process) I get a message that the port is taken.I reviewed the code and it seems to me that the problem is the server created in
listen()
, which is not closed bydestroy()
.My solution is to save the created server in some private variable and in the
destroy()
method end it with.close();
.I tested it locally and the solution releases the port, eliminating the problem.
The text was updated successfully, but these errors were encountered: