function callerFile() {
    const trace = new j$.StackTrace(util.errorWithStack());
    return trace.frames[2].file;
  }
Replaces Jasmine's global error handling with a spy. This prevents Jasmine
from treating uncaught exceptions and unhandled promise rejections
as spec failures and allows them to be inspected using the spy's
{@link Spy#calls|calls property} and related matchers such as
{@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}.

After installing the spy, spyOnGlobalErrorsAsync immediately calls its
argument, which must be an async or promise-returning function. The spy
will be passed as the first argument to that callback. Normal error
handling will be restored when the promise returned from the callback is
settled.

When the JavaScript runtime reports an uncaught error or unhandled rejection,
the spy will be called with a single parameter representing Jasmine's best
effort at describing the error. This parameter may be of any type, because
JavaScript allows anything to be thrown or used as the reason for a
rejected promise, but Error instances and strings are most common.

Note: The JavaScript runtime may deliver uncaught error events and unhandled
rejection events asynchronously, especially in browsers. If the event
occurs after the promise returned from the callback is settled, it won't
be routed to the spy even if the underlying error occurred previously.
It's up to you to ensure that all of the error/rejection events that you
want to handle have occurred before you resolve the promise returned from
the callback.

You must ensure that the `it`/`beforeEach`/etc fn that called
`spyOnGlobalErrorsAsync` does not signal completion until after the
promise returned by `spyOnGlobalErrorsAsync` is resolved. Normally this is
done by `await`ing the returned promise. Leaving the global error spy
installed after the `it`/`beforeEach`/etc fn that installed it signals
completion is likely to cause problems and is not supported.
@name jasmine.spyOnGlobalErrorsAsync
@function
@async
@param {AsyncFunction} fn - A function to run, during which the global error spy will be effective
@example
it('demonstrates global error spies', async function() {
  await jasmine.spyOnGlobalErrorsAsync(async function(globalErrorSpy) {
    setTimeout(function() {
      throw new Error('the expected error');
    });
    await new Promise(function(resolve) {
      setTimeout(resolve);
    });
    const expected = new Error('the expected error');
    expect(globalErrorSpy).toHaveBeenCalledWith(expected);
  });
});