I'm pretty sure that you could directly patch the process global itself for this (although that breaks every styleguide in existence), only requiring a single import statement for the entire program in its "index.js"/equivalent.
I have verified that it actually patches the property globally, as this code works as you would think:
// a.js
console.log('typeof process.exit: ' + typeof process.exit);
var exit = require('./b');
console.log('typeof process.exit: ' + typeof process.exit);
console.log('process.exit value: ' + process.exit);
process.exit = exit;
exit();
// b.js
var exit = process.exit;
process.exit = 1;
module.exports = exit;
Output:
typeof process.exit: function
typeof process.exit: number
process.exit value: 1
I'm not sure if this would be a good idea or not, so this is more of a conceptual proposal than anything.