test: add and use spawnSyncAndExit() and spawnSyncAndExitWithoutError()
Replaces expectSyncExit() and expectSyncExitWithoutError(). Since we usually just check the child process right after its spawned, these shorthands also takes care of the spawning. This makes the tests more concise.
I just realized that these shorthands may be more handy in some cases, so added them and switched to these instead (before we start to use them everywhere)