docs: function initJasmineWd(scheduler, webdriver) {
    if (jasmine.JasmineWdInitialized) {
      throw Error('JasmineWd already initialized when init() was called');
    }
    jasmine.JasmineWdInitialized = true;
  
  
    // Pull information from webdriver instance
    if (webdriver) {
      WebElement = webdriver.WebElement || WebElement;
      idleEventName = (
              webdriver.promise &&
              webdriver.promise.ControlFlow &&
              webdriver.promise.ControlFlow.EventType &&
              webdriver.promise.ControlFlow.EventType.IDLE
          ) || idleEventname;
    }
  
    // Default to mock scheduler
    if (!scheduler) {
      scheduler = { execute: function(fn) {
        return Promise.resolve().then(fn);
      } };
    }
  
    // Figure out how we're getting new promises
    var newPromise;
    if (typeof scheduler.promise == 'function') {
      newPromise = scheduler.promise.bind(scheduler);
    } else if (webdriver && webdriver.promise && webdriver.promise.ControlFlow &&
        (scheduler instanceof webdriver.promise.ControlFlow) &&
        (webdriver.promise.USE_PROMISE_MANAGER !== false)) {
      newPromise = function(resolver) {
        return new webdriver.promise.Promise(resolver, scheduler);
      };
    } else {
      newPromise = function(resolver) {
        return new Promise(resolver);
      };
    }
  
    // Wrap functions
    global.it = wrapInScheduler(scheduler, newPromise, global.it, 'it');
    global.fit = wrapInScheduler(scheduler, newPromise, global.fit, 'fit');
    global.beforeEach = wrapInScheduler(scheduler, newPromise, global.beforeEach, 'beforeEach');
    global.afterEach = wrapInScheduler(scheduler, newPromise, global.afterEach, 'afterEach');
    global.beforeAll = wrapInScheduler(scheduler, newPromise, global.beforeAll, 'beforeAll');
    global.afterAll = wrapInScheduler(scheduler, newPromise, global.afterAll, 'afterAll');
  
    // Reset API
    if (scheduler.reset) {
      // On timeout, the flow should be reset. This will prevent webdriver tasks
      // from overflowing into the next test and causing it to fail or timeout
      // as well. This is done in the reporter instead of an afterEach block
      // to ensure that it runs after any afterEach() blocks with webdriver tasks
      // get to complete first.
      jasmine.getEnv().addReporter(new OnTimeoutReporter(function() {
        console.warn('A Jasmine spec timed out. Resetting the WebDriver Control Flow.');
        scheduler.reset();
      }));
    }
  }