angular-cn/packages/upgrade/test/static/integration
George Kalpakas 4e17212d44 test(upgrade): properly clean up after tests to avoid errors in unrelated tests (#28013)
Many `ngUpgrade` tests need to manually [bootstrap modules][1] (instead
of using `TestBed` which automatically cleans up) and thus need to also
manually clean up afterwards (e.g. by calling [destroyPlatform()][2]
after each test).

Failing to destroy the platform is usually not a problem, unless the
next test tries to manually destroy it (as a precaution), as happens
[here][3] (among other places).

More specifically, the problem happens, because (as part of the clean-up
happening on platform destruction) upgraded components will try to
[call a method][4] on `angular.element` after `angular` has been
[set to `undefined`][5] (assuming the last test was using the
[withEachNg1Version()][6] helper).

Because the test order is pseudo-random and thus different on each run,
these errors did not always come up and - when they did- they would go
away after a couple of reruns, making them appear as flakes on CI.

(For reference, the issue was introduced in 43c33d566.)

This commit eliminates the issue by always destroying the platform after
each `ngUpgrade` test.

Jira issue: FW-924

[1]: c3aa24c3f9/packages/upgrade/test/static/test_helpers.ts (L21)
[2]: c3aa24c3f9/packages/upgrade/test/static/integration/upgrade_component_spec.ts (L24)
[3]: c3aa24c3f9/packages/elements/test/create-custom-element_spec.ts (L31)
[4]: c3aa24c3f9/packages/upgrade/src/common/upgrade_helper.ts (L134-L135)
[5]: c3aa24c3f9/packages/upgrade/test/common/test_helpers.ts (L115)
[6]: c3aa24c3f9/packages/upgrade/test/common/test_helpers.ts (L31)

PR Close #28013
2019-01-09 10:27:46 -08:00
..
change_detection_spec.ts fix(ivy): use NgZone.onStable when bootstraped using PlatformRef (#27898) 2019-01-08 14:10:53 -08:00
content_projection_spec.ts test(ivy): add ability to find already passing tests (#27449) 2018-12-05 09:34:52 -08:00
downgrade_component_spec.ts test(upgrade): update test failure cause descriptions (#27660) 2018-12-17 14:51:34 -08:00
downgrade_module_spec.ts test(upgrade): properly clean up after tests to avoid errors in unrelated tests (#28013) 2019-01-09 10:27:46 -08:00
examples_spec.ts test(ivy): add ability to find already passing tests (#27449) 2018-12-05 09:34:52 -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 test(ivy): re-enable passing upgrade tests (#27736) 2018-12-18 13:19:28 -08:00