@types/jest
Advanced tools
Comparing version 16.0.5 to 18.0.0
@@ -1,5 +0,6 @@ | ||
// Type definitions for Jest 16.0.0 | ||
// Type definitions for Jest 18.0.0 | ||
// Project: http://facebook.github.io/jest/ | ||
// Definitions by: Asana <https://asana.com>, Ivo Stratev <https://github.com/NoHomey>, jwbay <https://github.com/jwbay> | ||
// Definitions by: Asana <https://asana.com>, Ivo Stratev <https://github.com/NoHomey>, jwbay <https://github.com/jwbay>, Alexey Svetliakov <https://github.com/asvetliakov> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.1 | ||
@@ -19,3 +20,3 @@ declare var beforeAll: jest.Lifecycle; | ||
declare function expect(actual: any): jest.Matchers; | ||
declare const expect: jest.Expect; | ||
@@ -35,4 +36,8 @@ interface NodeRequire { | ||
function autoMockOn(): typeof jest; | ||
/** | ||
* @deprecated use resetAllMocks instead | ||
*/ | ||
function clearAllMocks(): typeof jest; | ||
/** Clears the mock.calls and mock.instances properties of all mocks. Equivalent to calling .mockClear() on every mocked function. */ | ||
function clearAllMocks(): typeof jest; | ||
function resetAllMocks(): typeof jest; | ||
/** Removes any pending timers from the timer system. If any timers have been scheduled, they will be cleared and will never have the opportunity to execute in the future. */ | ||
@@ -51,2 +56,3 @@ function clearAllTimers(): typeof jest; | ||
/** Creates a mock function. Optionally takes a mock implementation. */ | ||
function fn<T extends {}>(implementation: (...args: any[]) => T): Mock<T>; | ||
function fn<T>(implementation?: Function): Mock<T>; | ||
@@ -117,2 +123,37 @@ /** Use the automatic mocking system to generate a mocked version of the given module. */ | ||
interface MatcherUtils { | ||
readonly isNot: boolean; | ||
utils: { | ||
readonly EXPECTED_COLOR: string; | ||
readonly RECEIVED_COLOR: string; | ||
ensureActualIsNumber(actual: any, matcherName?: string): void; | ||
ensureExpectedIsNumber(actual: any, matcherName?: string): void; | ||
ensureNoExpected(actual: any, matcherName?: string): void; | ||
ensureNumbers(actual: any, expected: any, matcherName?: string): void; | ||
/** get the type of a value with handling of edge cases like `typeof []` and `typeof null` */ | ||
getType(value: any): string; | ||
matcherHint(matcherName: string, received?: string, expected?: string, options?: { secondArgument?: string, isDirectExpectCall?: boolean }): string; | ||
pluralize(word: string, count: number): string; | ||
printExpected(value: any): string; | ||
printReceived(value: any): string; | ||
printWithType(name: string, received: any, print: (value: any) => string): string; | ||
stringify(object: {}, maxDepth?: number): string; | ||
} | ||
} | ||
interface ExpectExtendMap { | ||
[key: string]: (this: MatcherUtils, received: any, actual: any) => { message: () => string, pass: boolean }; | ||
} | ||
interface Expect { | ||
(actual: any): Matchers; | ||
anything(): void; | ||
any(classType: any): void; | ||
arrayContaining(arr: any[]): void; | ||
assertions(num: number): void; | ||
extend(obj: ExpectExtendMap): void; | ||
objectContaining(obj: {}): void; | ||
stringMatching(str: string | RegExp): void; | ||
} | ||
interface Matchers { | ||
@@ -142,5 +183,7 @@ not: Matchers; | ||
toHaveBeenLastCalledWith(...params: any[]): boolean; | ||
toHaveLength(expected: number): void; | ||
toHaveProperty(propertyPath: string, value?: any): void; | ||
toMatch(expected: string | RegExp): void; | ||
toMatchObject(expected: {}): void; | ||
toMatchSnapshot(): void; | ||
toMatchSnapshot(snapshotName?: string): void; | ||
toThrow(): void; | ||
@@ -155,5 +198,21 @@ toThrowError(error?: string | Constructable | RegExp): void; | ||
interface Mock<T> extends Function { | ||
interface Mock<T> extends Function, MockInstance<T> { | ||
new (): T; | ||
(...args: any[]): any; | ||
} | ||
/** | ||
* Wrap module with mock definitions | ||
* @example | ||
* jest.mock("../api"); | ||
* import { Api } from "../api"; | ||
* | ||
* const myApi: jest.Mocked<Api> = new Api() as any; | ||
* myApi.myApiMethod.mockImplementation(() => "test"); | ||
*/ | ||
type Mocked<T> = { | ||
[P in keyof T]: T[P] & MockInstance<T>; | ||
}; | ||
interface MockInstance<T> { | ||
mock: MockContext<T>; | ||
@@ -160,0 +219,0 @@ mockClear(): void; |
{ | ||
"name": "@types/jest", | ||
"version": "16.0.5", | ||
"version": "18.0.0", | ||
"description": "TypeScript definitions for Jest", | ||
"license": "MIT", | ||
"author": "Asana <https://asana.com>, Ivo Stratev <https://github.com/NoHomey>, jwbay <https://github.com/jwbay>", | ||
"author": "Asana <https://asana.com>, Ivo Stratev <https://github.com/NoHomey>, jwbay <https://github.com/jwbay>, Alexey Svetliakov <https://github.com/asvetliakov>", | ||
"main": "", | ||
@@ -15,4 +15,4 @@ "repository": { | ||
"peerDependencies": {}, | ||
"typesPublisherContentHash": "197c9924f2fdb5ae88a96b610a88e02c23d269a38a1c8adc9b0cf68f20b8cd4f", | ||
"typeScriptVersion": "2.0" | ||
"typesPublisherContentHash": "ff94b42c05c15cde837e101519d49f021c11f2823a9c247555a02c6b3f4c74fe", | ||
"typeScriptVersion": "2.1" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Mon, 30 Jan 2017 06:11:04 GMT | ||
* Last updated: Mon, 30 Jan 2017 18:45:28 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>. | ||
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>. |
@@ -6,8 +6,8 @@ { | ||
"data": { | ||
"authors": "Asana <https://asana.com>, Ivo Stratev <https://github.com/NoHomey>, jwbay <https://github.com/jwbay>", | ||
"authors": "Asana <https://asana.com>, Ivo Stratev <https://github.com/NoHomey>, jwbay <https://github.com/jwbay>, Alexey Svetliakov <https://github.com/asvetliakov>", | ||
"dependencies": {}, | ||
"pathMappings": {}, | ||
"libraryMajorVersion": 16, | ||
"libraryMajorVersion": 18, | ||
"libraryMinorVersion": 0, | ||
"typeScriptVersion": "2.0", | ||
"typeScriptVersion": "2.1", | ||
"libraryName": "Jest", | ||
@@ -42,5 +42,5 @@ "typingsPackageName": "jest", | ||
"hasPackageJson": false, | ||
"contentHash": "197c9924f2fdb5ae88a96b610a88e02c23d269a38a1c8adc9b0cf68f20b8cd4f" | ||
"contentHash": "ff94b42c05c15cde837e101519d49f021c11f2823a9c247555a02c6b3f4c74fe" | ||
}, | ||
"isLatest": true | ||
} |
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
18986
368