- Building Enterprise JavaScript Applications
- Daniel Li
- 131字
- 2021-07-23 16:31:31
Running the test API server in the background
Next, before we can run our tests, we must run our API server. However, the API server and the tests need to run at the same time, but there can only be one foreground process group attached to the terminal. We want this to be our test, so we can interact with it if required (for example, to stop the test). Therefore, we need to run our API server as a background process.
In Bash (and other shells that support job control), we can run a command as a background process by appending a single ampersand (&) after the command. Therefore, add the following lines after our Elasticsearch initiation block:
# Run our API server as a background process
yarn run serve &