refactor(testing): remove wrapping of Jasmine functions (#9564)
Instead, the async function now determines whether it should return a promise or instead call a done function parameter. Importing Jasmine functions from `@angular/core/testing` is no longer necessary and is now deprecated. Additionally, beforeEachProviders is also deprecated, as it is specific to the testing framework. Instead, use the new addProviders method directly. Before: ```js import {beforeEachProviders, it, describe, inject} from 'angular2/testing/core'; describe('my code', () => { beforeEachProviders(() => [MyService]); it('does stuff', inject([MyService], (service) => { // actual test }); }); ``` After: ```js import {addProviders, inject} from 'angular2/testing/core'; describe('my code', () => { beforeEach(() => { addProviders([MyService]); }); it('does stuff', inject([MyService], (service) => { // actual test }); }); ```
This commit is contained in:
@ -26,7 +26,7 @@ let _FakeAsyncTestZoneSpecType = (Zone as any /** TODO #9100 */)['FakeAsyncTestZ
|
||||
* @param fn
|
||||
* @returns {Function} The function wrapped to be executed in the fakeAsync zone
|
||||
*/
|
||||
export function fakeAsync(fn: Function): Function {
|
||||
export function fakeAsync(fn: Function): (...args: any[]) => any {
|
||||
if (Zone.current.get('FakeAsyncTestZoneSpec') != null) {
|
||||
throw new BaseException('fakeAsync() calls can not be nested');
|
||||
}
|
||||
|
Reference in New Issue
Block a user