composeStabilizers function

NgTestStabilizerFactory composeStabilizers(
  1. Iterable<NgTestStabilizerFactory> factories
)

Returns a composed sequence of factories as a single stabilizer.

Implementation

NgTestStabilizerFactory composeStabilizers(
  Iterable<NgTestStabilizerFactory> factories,
) {
  return (Injector injector, [TimerHookZone? zone]) {
    return _DelegatingNgTestStabilizer(factories.map((f) {
      // Most (i.e. all user-land) stabilizers do not have access to the
      // "secret" TimerHookZone. Only functions that are defined within this
      // package may have them, so we pass the zone to those functions only.
      if (f is AllowTimerHookZoneAccess) {
        return f(injector, zone);
      }
      // All other factories just are given an injector.
      return f(injector);
    }));
  };
}