aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Colin McDonnell <colinmcd94@gmail.com> 2023-06-09 17:10:19 -0700
committerGravatar GitHub <noreply@github.com> 2023-06-09 17:10:19 -0700
commit5df26a6a9b2fb6e38511b69340ff1f08211de873 (patch)
treee4dee55335f9280529c4d7f32d27383b47b3d9b4
parentfc3331628e07bac73913917d11aa3c884d751137 (diff)
downloadbun-5df26a6a9b2fb6e38511b69340ff1f08211de873.tar.gz
bun-5df26a6a9b2fb6e38511b69340ff1f08211de873.tar.zst
bun-5df26a6a9b2fb6e38511b69340ff1f08211de873.zip
Improve types for mocks (#3261)
* Add jest.fn to types * Fix type-tests
-rw-r--r--packages/bun-types/bun-test.d.ts7
-rw-r--r--packages/bun-types/http.d.ts2
2 files changed, 5 insertions, 4 deletions
diff --git a/packages/bun-types/bun-test.d.ts b/packages/bun-types/bun-test.d.ts
index ea0dfb6b4..c97d34d05 100644
--- a/packages/bun-types/bun-test.d.ts
+++ b/packages/bun-types/bun-test.d.ts
@@ -30,6 +30,7 @@ declare module "bun:test" {
interface Jest {
restoreAllMocks(): void;
+ fn<T extends AnyFunction>(): Mock<T>;
}
export const jest: Jest;
export namespace jest {
@@ -862,7 +863,7 @@ declare module "bun:test" {
/**
* Ensure that a mock function is called with specific arguments.
*/
- toHaveBeenCalledWith(...expected: Array<unknown>): void;
+ // toHaveBeenCalledWith(...expected: Array<unknown>): void;
};
}
@@ -1025,12 +1026,12 @@ declare namespace JestMock {
* List of the call order indexes of the mock. Jest is indexing the order of
* invocations of all mocks in a test file. The index is starting with `1`.
*/
- invocationCallOrder: Array<number>;
+ // invocationCallOrder: Array<number>;
/**
* List of the call arguments of the last call that was made to the mock.
* If the function was not called, it will return `undefined`.
*/
- lastCall?: Parameters<T>;
+ // lastCall?: Parameters<T>;
/**
* List of the results of all calls that have been made to the mock.
*/
diff --git a/packages/bun-types/http.d.ts b/packages/bun-types/http.d.ts
index 30571b4b6..710fea4f4 100644
--- a/packages/bun-types/http.d.ts
+++ b/packages/bun-types/http.d.ts
@@ -987,7 +987,7 @@ declare module "http" {
* in the response to be dropped and the socket to be destroyed.
* @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead.
*/
- // abort(): void;
+ abort(): void;
/**
* Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called.
* @param timeout Milliseconds before a request times out.