resetEarlyErrorHandlersForTest function

  1. @visibleForTesting
void resetEarlyErrorHandlersForTest()

Resets the early-error buffer state for tests. The buffer and the installed-flag are module-level statics that persist across test cases in one VM, so without a reset the buffer/flush assertions become order- dependent (Issue 63).

Implementation

@visibleForTesting
void resetEarlyErrorHandlersForTest() {
  _earlyErrorBuffer.clear();
  _deferredBootstrapReports.clear();
  _errorHandlingAttached = false;
  // Phase 3 chokepoint state is module-level too — reset it alongside so the
  // dedup/re-entrancy/active-reporter assertions stay order-independent.
  _reportingInFlight = false;
  _recentErrorKeys.clear();
  _activeReporter = null;
}