test: don't call process.exit() in debugger tests

process.exit() tends to hide bugs, both in tests and node.js.
Rewrite the tests so that the event loop exits naturally.