There is to my knowledge no such utility, but it is easily implemented in a shell script.
A short shell script that implements what you described:
#!/bin/sh
serve ./public & serve_pid=$!
./run-chrome-tests.sh
kill "$serve_pid"
You may want to insert a sleep 3
call (or similar) after starting serve
in the background, to allow it to initialize properly before running the testing script.
$!
will be the PID of the most recently started background job (the serve
process). When the run-chrome-tests.sh
script finishes, the script above will explicitly terminate the serve
process by signalling using kill
.