Fail Jest tests for unhandled Promise rejections

The following fails in Jest:

  it('fails', () => {
    return Promise.reject(new Error('oops'));
  });

However the following doesn't:

  it("doesn't fail", () => {
    setTimeout(() => Promise.reject(new Error('oops'), 1000));
  });

We should register a listener for the unhandledRejection event and fail the test suite in that case.

see also https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21426/diffs?commit_id=d2a0e92ba2f4eba1111295065eb5d3fcd9307c8c