()
| 425 | } |
| 426 | |
| 427 | finalize(): NgModuleRef<any> { |
| 428 | // One last compile |
| 429 | this.compileTypesSync(); |
| 430 | |
| 431 | // Create the testing module itself. |
| 432 | this.compileTestModule(); |
| 433 | |
| 434 | this.applyTransitiveScopes(); |
| 435 | |
| 436 | this.applyProviderOverrides(); |
| 437 | |
| 438 | // Patch previously stored `styles` Component values (taken from ɵcmp), in case these |
| 439 | // Components have `styleUrls` fields defined and template override was requested. |
| 440 | this.patchComponentsWithExistingStyles(); |
| 441 | |
| 442 | // Clear the componentToModuleScope map, so that future compilations don't reset the scope of |
| 443 | // every component. |
| 444 | this.componentToModuleScope.clear(); |
| 445 | |
| 446 | const parentInjector = this.platform.injector; |
| 447 | this.testModuleRef = new NgModuleRef(this.testModuleType, parentInjector, []); |
| 448 | |
| 449 | // ApplicationInitStatus.runInitializers() is marked @internal to core. |
| 450 | // Cast it to any before accessing it. |
| 451 | (this.testModuleRef.injector.get(ApplicationInitStatus) as any).runInitializers(); |
| 452 | |
| 453 | // Set locale ID after running app initializers, since locale information might be updated while |
| 454 | // running initializers. This is also consistent with the execution order while bootstrapping an |
| 455 | // app (see `packages/core/src/application_ref.ts` file). |
| 456 | const localeId = this.testModuleRef.injector.get(LOCALE_ID, DEFAULT_LOCALE_ID); |
| 457 | setLocaleId(localeId); |
| 458 | |
| 459 | return this.testModuleRef; |
| 460 | } |
| 461 | |
| 462 | /** |
| 463 | * @internal |
no test coverage detected