angular-cn/packages/platform-server
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
..
src docs: update platform-server to use `@publicApi` tags (#26595) 2018-10-19 14:35:53 -07:00
test fix(ivy): TestBed should not clobber compilation of global-scope modules (#28033) 2019-01-11 11:18:10 -08:00
testing docs: convert all `@experimental` tags to `@publicApi` tags (#26595) 2018-10-19 14:35:52 -07:00
BUILD.bazel build: restrict visibility of npm_package targets (#27611) 2018-12-14 10:20:40 -08:00
index.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
package.json fix(platform-server): add @angular/http to the list of peerDependencies (#27307) 2018-11-30 10:02:44 -08:00
public_api.ts build: refactor ambient node & jasmine types so they are only included where needed (#25491) 2018-08-16 13:46:43 -07:00
rollup.config.js feat(core): upgrade rxjs to 6.0.0-alpha.4 (#22573) 2018-03-19 21:51:51 -07:00
tsconfig-build.json build: remove references to `tsc-wrapped` (#19298) 2017-09-21 13:55:52 -07:00