code: function getParentHooks(context) {
    var getOrderedHooks = function(context, type) {
      var hooks = [].concat(context['_' + type]).map(function(hook) {
        return createWrapper(hook.fn);
      });
  
      if (!context.parent) return hooks;
  
      return hooks.concat(getOrderedHooks(context.parent, type));
    };
  
    return ['beforeEach', 'afterEach'].reduce(function(res, type) {
      var array = getOrderedHooks(context, type);
      // parent beforeEach runs before child beforeEach
      if (type === 'beforeEach') {
        array.reverse();
      }
  
      res[type] = function() {
        var promise = Promise.resolve();
        array.forEach(function(hook) {
          promise = promise.then(hook());
        });
  
        return promise;
      };
      return res;
    }, {});
  }
docs: Wraps the existing hooks into a series of promises. Returns an object with
  two functions: beforeEach and afterEach. Each function returns a promise
  that resolves once all parents hooks have completed, recursively.
  
  @param   {Context} context
  @returns {object}