()
| 889 | } |
| 890 | |
| 891 | private destroyActiveFixtures(): void { |
| 892 | let errorCount = 0; |
| 893 | this._activeFixtures.forEach((fixture) => { |
| 894 | try { |
| 895 | fixture.destroy(); |
| 896 | } catch (e) { |
| 897 | errorCount++; |
| 898 | |
| 899 | if (fixture instanceof ComponentFixture) { |
| 900 | console.error('Error during cleanup of component', { |
| 901 | component: fixture.componentInstance, |
| 902 | stacktrace: e, |
| 903 | }); |
| 904 | } else if (fixture instanceof DirectiveFixture) { |
| 905 | console.error('Error during cleanup of directive', { |
| 906 | component: fixture.directiveInstance, |
| 907 | stacktrace: e, |
| 908 | }); |
| 909 | } else { |
| 910 | console.error('Error during cleanup of fixture', e); |
| 911 | } |
| 912 | } |
| 913 | }); |
| 914 | this._activeFixtures = []; |
| 915 | |
| 916 | if (errorCount > 0 && this.shouldRethrowTeardownErrors()) { |
| 917 | throw Error( |
| 918 | `${errorCount} ${errorCount === 1 ? 'fixture' : 'fixtures'} ` + |
| 919 | `threw errors during cleanup`, |
| 920 | ); |
| 921 | } |
| 922 | } |
| 923 | |
| 924 | shouldRethrowTeardownErrors(): boolean { |
| 925 | const instanceOptions = this._instanceTeardownOptions; |
no test coverage detected