code: function patchHooks(hooks) {
    var original = {};
    var restore;
  
    hookTypes.map(function(key) {
      original[key] = global[key];
  
      global[key] = function(title, fn) {
        // Hooks accept an optional title, though they're
        // ignored here for simplicity
        if (!fn) fn = title;
        hooks[key] = createWrapper(fn);
      };
    });
  
    restore = function() {
      hookTypes.forEach(function(key) {
        global[key] = original[key];
      });
    };
  
    return restore;
  }
docs: Patches the global hook functions used by mocha, and returns a function
  that restores the original behavior when invoked.
  
  @param   {object}   hooks Object on which to add hooks
  @returns {function} Function that restores the original it() behavior