Skip to content

Commit

Permalink
Add setTimeout as available method (flow-typed#1515)
Browse files Browse the repository at this point in the history
  • Loading branch information
gantoine authored Nov 11, 2017
1 parent bd0dc7e commit 8651382
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,12 @@ type JestObjectType = {
* Creates a mock function similar to jest.fn but also tracks calls to
* object[methodName].
*/
spyOn(object: Object, methodName: string): JestMockFn
spyOn(object: Object, methodName: string): JestMockFn,
/**
* Set the default timeout interval for tests and before/after hooks in milliseconds.
* Note: The default timeout interval is 5 seconds if this method is not called.
*/
setTimeout(timeout: number): JestObjectType
};

type JestSpyType = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ jest.resetModules().resetModules();

jest.spyOn({}, "foo");

jest.setTimeout(1000);

expect.addSnapshotSerializer(JSON.stringify);
expect.assertions(1);
expect.hasAssertions();
Expand Down
7 changes: 6 additions & 1 deletion definitions/npm/jest_v21.x.x/flow_v0.39.x-/jest_v21.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,12 @@ type JestObjectType = {
* Creates a mock function similar to jest.fn but also tracks calls to
* object[methodName].
*/
spyOn(object: Object, methodName: string): JestMockFn<any, any>
spyOn(object: Object, methodName: string): JestMockFn<any, any>,
/**
* Set the default timeout interval for tests and before/after hooks in milliseconds.
* Note: The default timeout interval is 5 seconds if this method is not called.
*/
setTimeout(timeout: number): JestObjectType
};

type JestSpyType = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ jest.resetModules().resetModules();

jest.spyOn({}, "foo");

jest.setTimeout(1000);

expect.addSnapshotSerializer(JSON.stringify);
expect.assertions(1);
expect.hasAssertions();
Expand Down

0 comments on commit 8651382

Please sign in to comment.