clearPendingTimers

export clearPendingTimers() : void

exported from angular2/testing defined in angular2/src/testing/fake_async.ts (line 68)

Clear the queue of pending timers and microtasks.

Useful for cleaning up after an asynchronous test passes.

Example

describe('this test', () => { it('aborts a timer', <any>fakeAsync((): void => { // This timer is scheduled but doesn't need to complete for the // test to pass (maybe it's a timeout for some operation). // Leaving it will cause the test to fail... setTimeout(() => {}, 100); // Unless we clean it up first. clearPendingTimers(); })); });