Added a note about correct usage of async matchers
This commit is contained in:
@@ -3722,7 +3722,29 @@ getJasmineRequireObj().Expectation = function(j$) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asynchronous matchers.
|
* Asynchronous matchers that operate on an actual value which is a promise,
|
||||||
|
* and return a promise.
|
||||||
|
*
|
||||||
|
* Note: Specs must await the result of each async matcher, return the
|
||||||
|
* promise returned by the matcher, or return a promise that's derived from
|
||||||
|
* the one returned by the matcher. Otherwise the matcher will not be
|
||||||
|
* evaluated before the spec completes.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // Good
|
||||||
|
* await expectAsync(aPromise).toBeResolved();
|
||||||
|
* @example
|
||||||
|
* // Good
|
||||||
|
* return expectAsync(aPromise).toBeResolved();
|
||||||
|
* @example
|
||||||
|
* // Good
|
||||||
|
* return expectAsync(aPromise).toBeResolved()
|
||||||
|
* .then(function() {
|
||||||
|
* // more spec code
|
||||||
|
* });
|
||||||
|
* @example
|
||||||
|
* // Bad
|
||||||
|
* expectAsync(aPromise).toBeResolved();
|
||||||
* @namespace async-matchers
|
* @namespace async-matchers
|
||||||
*/
|
*/
|
||||||
function AsyncExpectation(options) {
|
function AsyncExpectation(options) {
|
||||||
|
|||||||
@@ -43,7 +43,29 @@ getJasmineRequireObj().Expectation = function(j$) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Asynchronous matchers.
|
* Asynchronous matchers that operate on an actual value which is a promise,
|
||||||
|
* and return a promise.
|
||||||
|
*
|
||||||
|
* Note: Specs must await the result of each async matcher, return the
|
||||||
|
* promise returned by the matcher, or return a promise that's derived from
|
||||||
|
* the one returned by the matcher. Otherwise the matcher will not be
|
||||||
|
* evaluated before the spec completes.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // Good
|
||||||
|
* await expectAsync(aPromise).toBeResolved();
|
||||||
|
* @example
|
||||||
|
* // Good
|
||||||
|
* return expectAsync(aPromise).toBeResolved();
|
||||||
|
* @example
|
||||||
|
* // Good
|
||||||
|
* return expectAsync(aPromise).toBeResolved()
|
||||||
|
* .then(function() {
|
||||||
|
* // more spec code
|
||||||
|
* });
|
||||||
|
* @example
|
||||||
|
* // Bad
|
||||||
|
* expectAsync(aPromise).toBeResolved();
|
||||||
* @namespace async-matchers
|
* @namespace async-matchers
|
||||||
*/
|
*/
|
||||||
function AsyncExpectation(options) {
|
function AsyncExpectation(options) {
|
||||||
|
|||||||
Reference in New Issue
Block a user