fix(ivy): allow `R3TestBedCompiler` to work in ngcc-processed apps (#28530)
Previously, `R3TestBedCompiler` was dynamically defining an `@NgModule`-decorated `CompilerModule` class inside a method call. Since ngcc only processes top-level classes, this class was not transformed causing failures in unit tests (see #30121 for details). This commit fixes it by using `compileNgModuleDefs()` directly (similar to the fix in #30037). Fixes #30121 PR Close #28530
This commit is contained in:
parent
5b80ab372d
commit
066ec33342
|
@ -548,9 +548,8 @@ export class R3TestBedCompiler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(ocombe): make this work with an Injector directly instead of creating a module for it
|
// TODO(ocombe): make this work with an Injector directly instead of creating a module for it
|
||||||
@NgModule({providers})
|
class CompilerModule {}
|
||||||
class CompilerModule {
|
compileNgModuleDefs(CompilerModule as NgModuleType<any>, {providers});
|
||||||
}
|
|
||||||
|
|
||||||
const CompilerModuleFactory = new R3NgModuleFactory(CompilerModule);
|
const CompilerModuleFactory = new R3NgModuleFactory(CompilerModule);
|
||||||
this._injector = CompilerModuleFactory.create(this.platform.injector).injector;
|
this._injector = CompilerModuleFactory.create(this.platform.injector).injector;
|
||||||
|
|
Loading…
Reference in New Issue