Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"strip-json-comments": "^3.1.1",
"tempy": "^1.0.1",
"ts-node": "^10.5.0",
"tstyche": "^5.0.0",
"tstyche": "^6.0.2",
"typescript": "^5.8.3",
"typescript-eslint": "^8.38.0",
"webpack": "^5.68.0",
Expand Down
22 changes: 13 additions & 9 deletions packages/jest-mock/__typetests__/mock-functions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('jest.fn()', () => {

test('.getMockImplementation()', () => {
expect(mockFn.getMockImplementation()).type.toBe<
((a: string, b?: number | undefined) => boolean) | undefined
((this: Date, a: string, b?: number | undefined) => boolean) | undefined
>();

expect(mockFn.getMockImplementation).type.not.toBeCallableWith('some-mock');
Expand Down Expand Up @@ -181,15 +181,15 @@ describe('jest.fn()', () => {

test('.mockClear()', () => {
expect(mockFn.mockClear()).type.toBe<
Mock<(a: string, b?: number | undefined) => boolean>
Mock<(this: Date, a: string, b?: number | undefined) => boolean>
>();

expect(mockFn.mockClear).type.not.toBeCallableWith('some-mock');
});

test('.mockReset()', () => {
expect(mockFn.mockReset()).type.toBe<
Mock<(a: string, b?: number | undefined) => boolean>
Mock<(this: Date, a: string, b?: number | undefined) => boolean>
>();

expect(mockFn.mockReset).type.not.toBeCallableWith('some-mock');
Expand All @@ -208,7 +208,9 @@ describe('jest.fn()', () => {
expect(b).type.toBe<number | undefined>();
return false;
}),
).type.toBe<Mock<(a: string, b?: number | undefined) => boolean>>();
).type.toBe<
Mock<(this: Date, a: string, b?: number | undefined) => boolean>
>();

expect(mockFn.mockImplementation).type.not.toBeCallableWith(
(a: number) => false,
Expand All @@ -235,7 +237,9 @@ describe('jest.fn()', () => {
expect(b).type.toBe<number | undefined>();
return false;
}),
).type.toBe<Mock<(a: string, b?: number | undefined) => boolean>>();
).type.toBe<
Mock<(this: Date, a: string, b?: number | undefined) => boolean>
>();

expect(mockFn.mockImplementationOnce).type.not.toBeCallableWith(
(a: number) => false,
Expand All @@ -258,7 +262,7 @@ describe('jest.fn()', () => {

test('.mockName()', () => {
expect(mockFn.mockName('mockedFunction')).type.toBe<
Mock<(a: string, b?: number | undefined) => boolean>
Mock<(this: Date, a: string, b?: number | undefined) => boolean>
>();

expect(mockFn.mockName).type.not.toBeCallableWith(123);
Expand All @@ -267,15 +271,15 @@ describe('jest.fn()', () => {

test('.mockReturnThis()', () => {
expect(mockFn.mockReturnThis()).type.toBe<
Mock<(a: string, b?: number | undefined) => boolean>
Mock<(this: Date, a: string, b?: number | undefined) => boolean>
>();

expect(mockFn.mockReturnThis).type.not.toBeCallableWith('this');
});

test('.mockReturnValue()', () => {
expect(mockFn.mockReturnValue(false)).type.toBe<
Mock<(a: string, b?: number | undefined) => boolean>
Mock<(this: Date, a: string, b?: number | undefined) => boolean>
>();

expect(mockFn.mockReturnValue).type.not.toBeCallableWith('true');
Expand All @@ -292,7 +296,7 @@ describe('jest.fn()', () => {

test('.mockReturnValueOnce()', () => {
expect(mockFn.mockReturnValueOnce(false)).type.toBe<
Mock<(a: string, b?: number | undefined) => boolean>
Mock<(this: Date, a: string, b?: number | undefined) => boolean>
>();
expect(mockFn.mockReturnValueOnce).type.not.toBeCallableWith('true');

Expand Down
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4480,7 +4480,7 @@ __metadata:
strip-json-comments: "npm:^3.1.1"
tempy: "npm:^1.0.1"
ts-node: "npm:^10.5.0"
tstyche: "npm:^5.0.0"
tstyche: "npm:^6.0.2"
typescript: "npm:^5.8.3"
typescript-eslint: "npm:^8.38.0"
webpack: "npm:^5.68.0"
Expand Down Expand Up @@ -21446,17 +21446,17 @@ __metadata:
languageName: node
linkType: hard

"tstyche@npm:^5.0.0":
version: 5.0.2
resolution: "tstyche@npm:5.0.2"
"tstyche@npm:^6.0.2":
version: 6.0.2
resolution: "tstyche@npm:6.0.2"
peerDependencies:
typescript: ">=5.0"
typescript: ">=5.4"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jest supports TypeScript >=5.4. This must be fine.

peerDependenciesMeta:
typescript:
optional: true
bin:
tstyche: ./build/bin.js
checksum: 10/bbc11c2f7c5c1cbf4f848a9af1eef947cf9b2643491a59fb7dbaa903bb15bba620dad24904c3db6279f206a23599d97d47f9d9e00473c54f6bb9375a7dc26178
tstyche: ./dist/bin.js
checksum: 10/d739cefdf6c46d561535fa487c2348931c6075a8acbebf3f35bafe063f33114f3ce209cac5b66652113f46ad2e1a44589163914835fc59ea36d55b96e9428cfe
languageName: node
linkType: hard

Expand Down
Loading