()
| 973 | } |
| 974 | |
| 975 | tearDownTestingModule() { |
| 976 | // If the module ref has already been destroyed, we won't be able to get a test renderer. |
| 977 | if (this._testModuleRef === null) { |
| 978 | return; |
| 979 | } |
| 980 | // Resolve the renderer ahead of time, because we want to remove the root elements as the very |
| 981 | // last step, but the injector will be destroyed as a part of the module ref destruction. |
| 982 | const testRenderer = this.inject(TestComponentRenderer); |
| 983 | try { |
| 984 | this._testModuleRef.destroy(); |
| 985 | } catch (e) { |
| 986 | if (this.shouldRethrowTeardownErrors()) { |
| 987 | throw e; |
| 988 | } else { |
| 989 | console.error('Error during cleanup of a testing module', { |
| 990 | component: this._testModuleRef.instance, |
| 991 | stacktrace: e, |
| 992 | }); |
| 993 | } |
| 994 | } finally { |
| 995 | testRenderer.removeAllRootElements?.(); |
| 996 | } |
| 997 | } |
| 998 | |
| 999 | /** |
| 1000 | * Execute any pending effects by executing any pending work required to synchronize model to the UI. |
no test coverage detected