angular-cn/packages/platform-browser/test
Adrian Rutkowski c8f056beb6 fix(core): ensure TestBed is not instantiated before override provider (#38717)
There is an inconsistency in overrideProvider behaviour. Testing documentation says
(https://angular.io/guide/testing-components-basics#createcomponent) that all override...
methods throw error if TestBed is already instantiated. However overrideProvider doesn't throw any error, but (same as
other override... methods) doesn't replace providers if TestBed is instantiated. Add TestBed instantiation check to
overrideProvider method to make it consistent.

BREAKING CHANGE:

If you call `TestBed.overrideProvider` after TestBed initialization, provider overrides are not applied. This
behavior is consistent with other override methods (such as `TestBed.overrideDirective`, etc) but they
throw an error to indicate that, when the check was missing in the `TestBed.overrideProvider` function.
Now calling `TestBed.overrideProvider` after TestBed initialization also triggers an
error, thus there is a chance that some tests (where `TestBed.overrideProvider` is
called after TestBed initialization) will start to fail and require updates to move `TestBed.overrideProvider` calls
before TestBed initialization is completed.

Issue mentioned here: https://github.com/angular/angular/issues/13460#issuecomment-636005966
Documentation: https://angular.io/guide/testing-components-basics#createcomponent

PR Close #38717
2020-09-22 15:03:44 -07:00
..
browser build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
dom fix(core): should fake a top event task when coalescing events to prevent draining microTaskQueue too early. (#36841) 2020-06-11 18:54:22 -07:00
security build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
static_assets
BUILD.bazel build: enable platform-browser tests on Saucelabs (#36797) 2020-04-28 15:10:27 -07:00
browser_util_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
testing_public_spec.ts fix(core): ensure TestBed is not instantiated before override provider (#38717) 2020-09-22 15:03:44 -07:00