This document summarizes some new features of async testing in Angular, including:
- The async and fakeAsync functions for writing asynchronous tests and controlling time
- How fakeAsync can control Date.now(), timeouts, intervals, requestAnimationFrames, and promises
- Using jasmine.clock() to automatically run tests in fakeAsync mode
- Supporting pending non-resolved promises and async beforeEach/it blocks
- Support for Jasmine 2.9+, 3.x and Mocha 5.x
- Proposed enhancements like supporting more async operations and better timeout errors
12. fakeAsync: support more async operations
// tell fakeAsync should support HTMLCanvasElement.toBlob
window['__zone_symbol__FakeAsyncTestMacroTask'] = [{
source: 'HTMLCanvasElement.toBlob',
callbackArgs: [{size: 100}] // the test blob data which will be passed back to
callback
}];