angular-cn/packages/upgrade/test/static/integration
George Kalpakas 3b7a571cc5 test(upgrade): clean up global state after test (#28181)
In ngUpgradeLite, when a downgraded component
[requests its downgraded module][1], the AngularJS injector is
[temporarily stored][2] with the intention of grabbing it
[once the module has been bootstrapped][3] (which also cleans up the
[temporary injector reference][4]).

In [some tests][5], bootstrapping a component might throw an error,
which causes the test to fail immediatelly and move on to the next
test. In slow browsers (e.g. on CI/Saucelabs), the (successful)
bootstrapping of another downgraded module might not have been
completed in time and thus the temporary injector reference not cleaned
up.

In such a case, if the following test (in our randomized test suite)
happens to rely on the temporary injector reference's being initially
unset (such as [this test][6]), it will fail. This might appear as a
flake on CI, because it depends on a race condition and specific order
of tests, so it usually goes away after a rerun.

This commit fixes it by ensuring the temporary injector reference is
manually cleaned up, when necessary.

Jira issue: FW-939

[1]: f983e99fb2/packages/upgrade/src/common/downgrade_component.ts (L120)
[2]: f983e99fb2/packages/upgrade/src/static/downgrade_module.ts (L165)
[3]: f983e99fb2/packages/upgrade/src/static/downgrade_module.ts (L169)
[4]: f983e99fb2/packages/upgrade/src/static/angular1_providers.ts (L25)
[5]: f983e99fb2/packages/upgrade/test/static/integration/downgrade_module_spec.ts (L1331-L1381)
[6]: f983e99fb2/packages/upgrade/test/static/angular1_providers_spec.ts (L31-L45)

PR Close #28181
2019-01-16 09:45:01 -08:00
..
change_detection_spec.ts test(ivy): re-enable passing tests and misc cleanup (#28093) 2019-01-14 10:03:57 -08:00
content_projection_spec.ts fix(ivy): pass ngContentSelectors through to `defineComponent()` calls (#27867) 2019-01-10 13:36:37 -08:00
downgrade_component_spec.ts fix(ivy): ngOnChanges only runs for binding updates (#27965) 2019-01-11 14:28:35 -08:00
downgrade_module_spec.ts test(upgrade): clean up global state after test (#28181) 2019-01-16 09:45:01 -08:00
examples_spec.ts fix(ivy): pass ngContentSelectors through to `defineComponent()` calls (#27867) 2019-01-10 13:36:37 -08:00
injection_spec.ts test(upgrade): run tests against multiple AngularJS versions (#22167) 2018-02-25 10:06:14 -08:00
testability_spec.ts fix(upgrade): propagate return value of resumeBootstrap (#22754) 2018-04-02 14:20:58 -07:00
upgrade_component_spec.ts fix(ivy): don't cache render parent on LContainer to support ngUpgrade (#28011) 2019-01-09 15:35:57 -08:00