fix(ivy): explicitly compile ngModuleDef for RootScopeModule in R3TestBed (#30037)

This commit unifies the way auxillary RootScopeModule and DynamicTestModule are compiled in R3TestBed by calling `compileNgModuleDefs` explicitly for RootScopeModule. This change also resolves the problem where TestBed's code was used from the @angular/core NPM package: due to the "jit" flag, the @NgModule decorator on the RootScopeModule was transformed to RootScopeModule.decorators = [...], but actual ngModuleDef was never defined.

PR Close #30037
This commit is contained in:
Andrew Kushnir 2019-04-22 15:42:53 -07:00 committed by Ben Lesh
parent 8e73f9b0aa
commit 00ce9aab5b
1 changed files with 4 additions and 8 deletions

View File

@ -505,14 +505,10 @@ export class R3TestBedCompiler {
}
private compileTestModule(): void {
const rootProviderOverrides = this.rootProviderOverrides;
@NgModule({
providers: [...rootProviderOverrides],
jit: true,
})
class RootScopeModule {
}
class RootScopeModule {}
compileNgModuleDefs(RootScopeModule as NgModuleType<any>, {
providers: [...this.rootProviderOverrides],
});
const ngZone = new NgZone({enableLongStackTrace: true});
const providers: Provider[] = [