fix(fake_async): share zone between beforeEach
and it
This is needed for the case if a `beforeEach` instantiates `NgZone`and the `it` uses `TestComponentBuilder.createFakeAsync`. Otherwise the `NgZone` will use the root zone as parent, and `TestComponentBuilder.createFakeAsync` will always return undefined as `tick` does not forward promises created under the zone of `NgZone`.
This commit is contained in:
@ -14,15 +14,19 @@
|
||||
|
||||
import {SchemaMetadata} from '../index';
|
||||
|
||||
import {resetFakeAsyncZone} from './fake_async';
|
||||
import {TestBed, TestModuleMetadata, getTestBed} from './test_bed';
|
||||
|
||||
declare var global: any;
|
||||
|
||||
var _global = <any>(typeof window === 'undefined' ? global : window);
|
||||
|
||||
// Reset the test providers before each test.
|
||||
// Reset the test providers and the fake async zone before each test.
|
||||
if (_global.beforeEach) {
|
||||
_global.beforeEach(() => { TestBed.resetTestingModule(); });
|
||||
_global.beforeEach(() => {
|
||||
TestBed.resetTestingModule();
|
||||
resetFakeAsyncZone();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user