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

Method tearDownTestingModule

packages/core/testing/src/test_bed.ts:859–881  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

857 }
858
859 tearDownTestingModule() {
860 // If the module ref has already been destroyed, we won't be able to get a test renderer.
861 if (this._testModuleRef === null) {
862 return;
863 }
864 // Resolve the renderer ahead of time, because we want to remove the root elements as the very
865 // last step, but the injector will be destroyed as a part of the module ref destruction.
866 const testRenderer = this.inject(TestComponentRenderer);
867 try {
868 this._testModuleRef.destroy();
869 } catch (e) {
870 if (this.shouldRethrowTeardownErrors()) {
871 throw e;
872 } else {
873 console.error('Error during cleanup of a testing module', {
874 component: this._testModuleRef.instance,
875 stacktrace: e,
876 });
877 }
878 } finally {
879 testRenderer.removeAllRootElements?.();
880 }
881 }
882
883 /**
884 * Execute any pending effects by executing any pending work required to synchronize model to the UI.

Callers 1

resetTestingModuleMethod · 0.95

Calls 5

injectMethod · 0.95
destroyMethod · 0.65
errorMethod · 0.65
removeAllRootElementsMethod · 0.45

Tested by

no test coverage detected