angular/packages/core/src
Alex Rickabaugh df292c2ce0 fix(ivy): TestBed should not clobber compilation of global-scope modules (#28033)
When an @NgModule decorator executes, the module is added to a queue in
render3/jit/module.ts. Reading an ngComponentDef property causes this queue
to be flushed, ensuring that the component gets the correct module scope
applied.

In before_each.ts, a global beforeEach is added to all Angular tests which
calls TestBed.resetTestingModule() prior to running each test. This in turn
clears the module compilation queue (which is correct behavior, as modules
declared within the test should not leak outside of it via the queue).

So far this is okay. But before the first test runs, the module compilation
queue is full of modules declared in global scope. No definitions have been
read, so no flushes of the queue have been triggered. The global beforeEach
triggers a reset of the queue, aborting all of the in-progress global
compilation, breaking those classes when they're later used in tests.

This commit adds logic to TestBedRender3 to respect the state of the module
queue before the TestBed is first initialized or reset. The queue is flushed
prior to such an operation to ensure global compilation is allowed to finish
properly.

With this fix, a platform-server test now passes (previously the <my-child>
element was not detected as a component, because the encompassing module
never finished compilation.

FW-887 #resolve

PR Close #28033
2019-01-11 11:18:10 -08:00
..
change_detection build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
debug build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
di build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
i18n docs: convert all @experimental tags to @publicApi tags (#26595) 2018-10-19 14:35:52 -07:00
interface build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
linker fix(ivy): make module registration by id idempotent (#28033) 2019-01-11 11:18:09 -08:00
metadata build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
profile build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
reflection build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
render docs: update core to use @publicApi tags (#26595) 2018-10-19 14:35:53 -07:00
render3 fix(ivy): support multiple exportAs (#27996) 2019-01-10 16:53:26 -08:00
sanitization build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
testability build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
util build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
view build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
zone docs: convert all @experimental tags to @publicApi tags (#26595) 2018-10-19 14:35:52 -07:00
application_init.ts docs: update core to use @publicApi tags (#26595) 2018-10-19 14:35:53 -07:00
application_module.ts fix(ivy): use NgZone.onStable when bootstraped using PlatformRef (#27898) 2019-01-08 14:10:53 -08:00
application_ref.ts build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
application_tokens.ts docs: convert all @experimental tags to @publicApi tags (#26595) 2018-10-19 14:35:52 -07:00
change_detection.ts refactor(core): remove deprecated TrackByFn (#18757) 2017-08-18 13:23:46 -05:00
codegen_private_exports.ts refactor(compiler): don’t rely on global reflector (#16832) 2017-05-23 10:41:23 -06:00
console.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
core.externs.js fix: don’t use the global ng at all with closure enhanced optimizations 2017-09-27 10:09:56 -07:00
core.ts build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
core_private_export.ts build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
core_render3_private_export.ts fix(ivy): TestBed should not clobber compilation of global-scope modules (#28033) 2019-01-11 11:18:10 -08:00
di.ts build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
error_handler.ts build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
errors.ts build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
event_emitter.ts refactor(core): improve type for EventEmitter (#27228) 2019-01-10 17:02:52 -08:00
ivy_switch.ts refactor(ivy): obviate the Bazel component of the ivy_switch (#26550) 2018-10-19 09:23:05 -07:00
linker.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
metadata.ts feat(core): add DoBootstrap interface. (#24558) 2018-08-07 13:17:06 -07:00
platform_core_providers.ts docs: convert all @experimental tags to @publicApi tags (#26595) 2018-10-19 14:35:52 -07:00
r3_symbols.ts build: extract interface and util sub compilation from core (#28028) 2019-01-10 16:31:44 -08:00
render.ts refactor(core): use flags in Renderer2.setStyle instead of booleans (#15045) 2017-03-13 09:45:04 -07:00
version.ts docs: update core to use @publicApi tags (#26595) 2018-10-19 14:35:53 -07:00
zone.ts feat(router): warn if navigation triggered outside Angular zone (#24959) 2018-09-05 09:35:14 -07:00