code: function _reset() {
      terminating = false;
      if (termination_timeout) {
        termination_window.clearTimeout(termination_timeout);
        termination_timeout = undefined;
      }
      $modal.off();
      $modal.modal("hide");
      $modal.remove();
    }
docs: Normally onerror will be reset by reloading but when testing with mocha we don't want reloading, so we export this function.