Cleaning up the background process

We need to make a few last changes to our test script before we can run our tests. At the moment, we are running our API server in the background. However, when our script exits, the API will still keep running; this means we will get the listen EADDRINUSE :::8888 error the next time we run the E2E tests.

Therefore, we need to kill that background process before the test script exits. This can be done with the kill command. Add the following line at the end of the test script:

# Terminate all processes within the same process group by sending a SIGTERM signalkill -15 0

Process ID (PID) 0 (zero) is a special PID that represents all member processes within the same process group as the process that raised ...

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.