MCPcopy Index your code
hub / github.com/angular/angular / finalize

Method finalize

packages/core/testing/src/test_bed_compiler.ts:427–460  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 3

_recordImportsMethod · 0.45
testModuleRefMethod · 0.45

Calls 9

compileTypesSyncMethod · 0.95
compileTestModuleMethod · 0.95
applyTransitiveScopesMethod · 0.95
setLocaleIdFunction · 0.85
runInitializersMethod · 0.80
getMethod · 0.65
clearMethod · 0.45

Tested by

no test coverage detected