diff --git a/jest/index.d.ts b/jest/index.d.ts old mode 100644 new mode 100755 index 234583ef3e..595a42ea2b --- a/jest/index.d.ts +++ b/jest/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Jest 19.2.0 // Project: http://facebook.github.io/jest/ -// Definitions by: Asana , Ivo Stratev , jwbay , Alexey Svetliakov +// Definitions by: Asana , Ivo Stratev , jwbay , Alexey Svetliakov , Alex Jover Morales // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -77,6 +77,8 @@ declare namespace jest { function runTimersToTime(msToRun: number): typeof jest; /** Explicitly supplies the mock object that the module system should return for the specified module. */ function setMock(moduleName: string, moduleExports: T): typeof jest; + /** Creates a mock function similar to jest.fn but also tracks calls to object[methodName] */ + function spyOn(object: T, method: M): SpyInstance; /** Indicates that the module system should never return a mocked version of the specified module from require() (e.g. that it should always return the real module). */ function unmock(moduleName: string): typeof jest; /** Instructs Jest to use fake versions of the standard timer functions. */ @@ -245,6 +247,10 @@ declare namespace jest { (...args: any[]): any; } + interface SpyInstance extends MockInstance { + mockRestore(): void; + } + /** * Wrap module with mock definitions * @example