2016-06-23 09:47:54 -07:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
|
*/
|
|
|
|
|
|
2015-10-08 15:33:17 -07:00
|
|
|
/**
|
2016-06-24 17:48:35 -07:00
|
|
|
* Public Test Library for unit testing Angular2 Applications. Assumes that you are running
|
|
|
|
|
* with Jasmine, Mocha, or a similar framework which exports a beforeEach function and
|
|
|
|
|
* allows tests to be asynchronous by either returning a promise or using a 'done' parameter.
|
2015-10-08 15:33:17 -07:00
|
|
|
*/
|
|
|
|
|
|
2016-07-25 03:02:57 -07:00
|
|
|
import {SchemaMetadata} from '../index';
|
2016-07-28 04:54:49 -07:00
|
|
|
|
2016-08-02 04:45:15 -07:00
|
|
|
import {resetFakeAsyncZone} from './fake_async';
|
2016-07-28 04:54:49 -07:00
|
|
|
import {TestBed, TestModuleMetadata, getTestBed} from './test_bed';
|
2015-10-08 15:33:17 -07:00
|
|
|
|
2016-06-15 09:37:33 -07:00
|
|
|
declare var global: any;
|
2015-10-08 15:33:17 -07:00
|
|
|
|
2016-02-01 10:28:57 -08:00
|
|
|
var _global = <any>(typeof window === 'undefined' ? global : window);
|
2015-10-08 15:33:17 -07:00
|
|
|
|
2016-08-02 04:45:15 -07:00
|
|
|
// Reset the test providers and the fake async zone before each test.
|
2016-06-24 17:48:35 -07:00
|
|
|
if (_global.beforeEach) {
|
2016-08-02 04:45:15 -07:00
|
|
|
_global.beforeEach(() => {
|
|
|
|
|
TestBed.resetTestingModule();
|
|
|
|
|
resetFakeAsyncZone();
|
|
|
|
|
});
|
2015-10-08 15:33:17 -07:00
|
|
|
}
|
|
|
|
|
|
2015-11-18 18:46:24 -08:00
|
|
|
/**
|
2016-06-24 17:48:35 -07:00
|
|
|
* Allows overriding default providers of the test injector,
|
|
|
|
|
* which are defined in test_injector.js
|
2016-06-27 12:27:23 -07:00
|
|
|
*
|
2016-07-28 04:54:49 -07:00
|
|
|
* @deprecated Use `TestBed.configureTestingModule instead.
|
2015-11-18 18:46:24 -08:00
|
|
|
*/
|
2016-06-24 17:48:35 -07:00
|
|
|
export function addProviders(providers: Array<any>): void {
|
|
|
|
|
if (!providers) return;
|
2016-07-28 04:54:49 -07:00
|
|
|
TestBed.configureTestingModule({providers: providers});
|
2016-07-04 09:37:30 -07:00
|
|
|
}
|