fix(ivy): R3TestBed should clean up registered modules after each test (#32872)

PR Close #32872
This commit is contained in:
Andrew Scott
2019-09-26 17:03:29 -07:00
committed by atscott
parent 53b32f17b3
commit 475e36abb5
4 changed files with 23 additions and 4 deletions

View File

@ -17,7 +17,7 @@ import {expect} from '@angular/platform-browser/testing/src/matchers';
import {modifiedInIvy, obsoleteInIvy, onlyInIvy} from '@angular/private/testing';
import {InternalNgModuleRef, NgModuleFactory} from '../../src/linker/ng_module_factory';
import {clearModulesForTest} from '../../src/linker/ng_module_factory_registration';
import {clearModuleRegistry} from '../../src/linker/ng_module_factory_registration';
import {stringify} from '../../src/util/stringify';
class Engine {}
@ -294,7 +294,11 @@ function declareTests(config?: {useJit: boolean}) {
describe('id', () => {
const token = 'myid';
afterEach(() => clearModulesForTest());
// Ivy TestBed clears module registry in resetTestingModule so this afterEach is not needed
// for Ivy
if (!ivyEnabled) {
afterEach(() => clearModuleRegistry());
}
it('should register loaded modules', () => {
@NgModule({id: token})