exit = (code) => {
    if (process.env.NODE_ENV === 'test') {
        throw new Error(`Exit called with code: ${code}`);
    } else {
        process.exit(code);
    }
}
Custom exit function that handles both production and test environments
@param {number} code - Exit code to return
@throws {Error} In test environment instead of exiting