()
| 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. |
no test coverage detected