Random errors from unit and integration testing

So numerous times I’ve received the following errors:

listen EADDRINUSE: address already in use :::3000` 

and

unit_testing

I’ve been using the same code that Mosh has been using. First come the errors, then strangely enough I haven’t changed anything and now all tests are passing again… Has anyone else experienced this? Because I’ve been going on and off with it. Maybe it’s a bug?

Okay so I found a solution for the first error. Make sure you use await with server.close in every afterEach() function as they do use async to connect the database.

i tried both before and after , not working

@jufriazzq without async you can’t connect to your database, also async returns a promise and allows you to use await.