Allow async extension functions

According to http://jestjs.io/docs/en/expect.html#expectextendmatchers

> expect.extends also supports async matchers. Async matchers return a Promise so you will need to await the returned value. Let's use an example matcher to illustrate the usage of them. We are going to implement a very similar matcher than toBeDivisibleBy, only difference is that the divisible number is going to be pulled from an external source.

This updates the typings of `ExpectExtendMap` to allow a `Promise` to be returned.
This commit is contained in:
Dobes Vandermeer
2018-06-27 10:50:53 -07:00
parent 529a40a7c2
commit 9a3839b63b
+1 -1
View File
@@ -269,7 +269,7 @@ declare namespace jest {
}
interface ExpectExtendMap {
[key: string]: (this: MatcherUtils, received: any, ...actual: any[]) => { message(): string, pass: boolean };
[key: string]: (this: MatcherUtils, received: any, ...actual: any[]) => { message(): string, pass: boolean } | Promise<{ message(): string, pass: boolean }>;
}
interface SnapshotSerializerOptions {