@types/jest
Advanced tools
Comparing version 23.0.1 to 23.0.2
@@ -13,5 +13,6 @@ // Type definitions for Jest 23.0 | ||
// Douglas Duteil <https://github.com/douglasduteil> | ||
// Ahn <https://github.com/AhnpGit> | ||
// Ahn <https://github.com/ahnpnl> | ||
// Josh Goldberg <https://github.com/joshuakgoldberg> | ||
// Bradley Ayers <https://github.com/bradleyayers> | ||
// Jeff Lau <https://github.com/UselessPickles> | ||
// Andrew Makarov <https://github.com/r3nya> | ||
@@ -363,2 +364,10 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
/** | ||
* Ensures the last call to a mock function was provided specific args. | ||
*/ | ||
lastCalledWith(...args: any[]): R; | ||
/** | ||
* Ensure that the last call to a mock function has returned a specified value. | ||
*/ | ||
lastReturnedWith(value: any): R; | ||
/** | ||
* If you know how to test something, `.not` lets you test its opposite. | ||
@@ -368,2 +377,6 @@ */ | ||
/** | ||
* Ensure that the nth call to a mock function has returned a specified value. | ||
*/ | ||
nthReturnedWith(n: number, value: any): R; | ||
/** | ||
* Use resolves to unwrap the value of a fulfilled promise so any other | ||
@@ -378,3 +391,2 @@ * matcher can be chained. If the promise is rejected the assertion fails. | ||
rejects: Matchers<Promise<R>>; | ||
lastCalledWith(...args: any[]): R; | ||
/** | ||
@@ -477,2 +489,6 @@ * Checks that a value is what you expect. It uses `===` to check strict equality. | ||
/** | ||
* Ensure that a mock function is called with specific arguments on an Nth call. | ||
*/ | ||
toHaveBeenNthCalledWith(nthCall: number, ...params: any[]): R; | ||
/** | ||
* If you have a mock function, you can use `.toHaveBeenLastCalledWith` | ||
@@ -483,6 +499,7 @@ * to test what arguments it was last called with. | ||
/** | ||
* If you have a mock function, you can use `.toHaveBeenNthCalledWith` | ||
* to test what arguments it was nth called with. | ||
* Use to test the specific value that a mock function last returned. | ||
* If the last call to the mock function threw an error, then this matcher will fail | ||
* no matter what value you provided as the expected return value. | ||
*/ | ||
toHaveBeenNthCalledWith(nthCall: number, ...params: any[]): R; | ||
toHaveLastReturnedWith(expected: any): R; | ||
/** | ||
@@ -493,4 +510,23 @@ * Used to check that an object has a `.length` property | ||
toHaveLength(expected: number): R; | ||
/** | ||
* Use to test the specific value that a mock function returned for the nth call. | ||
* If the nth call to the mock function threw an error, then this matcher will fail | ||
* no matter what value you provided as the expected return value. | ||
*/ | ||
toHaveNthReturnedWith(nthCall: number, expected: any): R; | ||
toHaveProperty(propertyPath: string | any[], value?: any): R; | ||
/** | ||
* Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time | ||
*/ | ||
toHaveReturned(): R; | ||
/** | ||
* Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times. | ||
* Any calls to the mock function that throw an error are not counted toward the number of times the function returned. | ||
*/ | ||
toHaveReturnedTimes(expected: number): R; | ||
/** | ||
* Use to ensure that a mock function returned a specific value. | ||
*/ | ||
toHaveReturnedWith(expected: any): R; | ||
/** | ||
* Check that a string matches a regular expression. | ||
@@ -509,2 +545,18 @@ */ | ||
/** | ||
* Ensure that a mock function has returned (as opposed to thrown) at least once. | ||
*/ | ||
toReturn(): R; | ||
/** | ||
* Ensure that a mock function has returned (as opposed to thrown) a specified number of times. | ||
*/ | ||
toReturnTimes(count: number): R; | ||
/** | ||
* Ensure that a mock function has returned a specified value at least once. | ||
*/ | ||
toReturnWith(value: any): R; | ||
/** | ||
* Use to test that objects have the same types as well as structure. | ||
*/ | ||
toStrictEqual(expected: {}): R; | ||
/** | ||
* Used to test that a function throws when it is called. | ||
@@ -567,5 +619,25 @@ */ | ||
/** | ||
* Represents the result of a single call to a mock function. | ||
*/ | ||
interface MockResult { | ||
/** | ||
* True if the function threw. | ||
* False if the function returned. | ||
*/ | ||
isThrow: boolean; | ||
/** | ||
* The value that was either thrown or returned by the function. | ||
*/ | ||
value: any; | ||
} | ||
interface MockContext<T> { | ||
calls: any[][]; | ||
instances: T[]; | ||
invocationCallOrder: number[]; | ||
/** | ||
* List of results of calls to the mock function. | ||
*/ | ||
results: MockResult[]; | ||
} | ||
@@ -572,0 +644,0 @@ } |
{ | ||
"name": "@types/jest", | ||
"version": "23.0.1", | ||
"version": "23.0.2", | ||
"description": "TypeScript definitions for Jest", | ||
@@ -58,4 +58,4 @@ "license": "MIT", | ||
"name": "Ahn", | ||
"url": "https://github.com/AhnpGit", | ||
"githubUsername": "AhnpGit" | ||
"url": "https://github.com/ahnpnl", | ||
"githubUsername": "ahnpnl" | ||
}, | ||
@@ -73,2 +73,7 @@ { | ||
{ | ||
"name": "Jeff Lau", | ||
"url": "https://github.com/UselessPickles", | ||
"githubUsername": "UselessPickles" | ||
}, | ||
{ | ||
"name": "Andrew Makarov", | ||
@@ -86,4 +91,4 @@ "url": "https://github.com/r3nya", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "2f4dd0eff4a73d29fe3e654d8b3fc5d36a3d02a97a5c201ae888664a37f0db6d", | ||
"typesPublisherContentHash": "bb0c847e96d3d50c22a51738007a017831700c69d399a06ed19b6724cedce025", | ||
"typeScriptVersion": "2.3" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Mon, 11 Jun 2018 20:24:44 GMT | ||
* Last updated: Tue, 12 Jun 2018 03:36:26 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: afterAll, afterEach, beforeAll, beforeEach, describe, expect, fail, fdescribe, fit, it, jasmine, jest, pending, spyOn, test, xdescribe, xit, xtest | ||
# Credits | ||
These definitions were written by Asana <https://asana.com>, Ivo Stratev <https://github.com/NoHomey>, jwbay <https://github.com/jwbay>, Alexey Svetliakov <https://github.com/asvetliakov>, Alex Jover Morales <https://github.com/alexjoverm>, Allan Lukwago <https://github.com/epicallan>, Ika <https://github.com/ikatyang>, Waseem Dahman <https://github.com/wsmd>, Jamie Mason <https://github.com/JamieMason>, Douglas Duteil <https://github.com/douglasduteil>, Ahn <https://github.com/AhnpGit>, Josh Goldberg <https://github.com/joshuakgoldberg>, Bradley Ayers <https://github.com/bradleyayers>, Andrew Makarov <https://github.com/r3nya>. | ||
These definitions were written by Asana <https://asana.com>, Ivo Stratev <https://github.com/NoHomey>, jwbay <https://github.com/jwbay>, Alexey Svetliakov <https://github.com/asvetliakov>, Alex Jover Morales <https://github.com/alexjoverm>, Allan Lukwago <https://github.com/epicallan>, Ika <https://github.com/ikatyang>, Waseem Dahman <https://github.com/wsmd>, Jamie Mason <https://github.com/JamieMason>, Douglas Duteil <https://github.com/douglasduteil>, Ahn <https://github.com/ahnpnl>, Josh Goldberg <https://github.com/joshuakgoldberg>, Bradley Ayers <https://github.com/bradleyayers>, Jeff Lau <https://github.com/UselessPickles>, Andrew Makarov <https://github.com/r3nya>. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46450
1101