I understand it, but why are you doing it ? why don't you mock out the process.exit ? and just assert whether it was called, no reason for exception and try catch in the test