Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jest-globals): add Mocked* utility types to jest namespace / object #12425

Closed
wants to merge 0 commits into from
Closed

feat(jest-globals): add Mocked* utility types to jest namespace / object #12425

wants to merge 0 commits into from

Conversation

mrazauskas
Copy link
Contributor

@mrazauskas mrazauskas commented Feb 18, 2022

Summary

From #12424 (comment)

Currently jest object exported from @jest/globals is missing utility types like jest.MockedClass, jest.MockedFunction, which are available from @types/jest. jest-mock already has these types, so let’s try to fix this.

Obstacles:

  1. declare namespace jest { is necessary to make this work, but api-extractor is throwing away. Right now I was trying to avoid building @jest/globals, but it should be enough to disable bundling for it. There is just nothing to bundle. (Same with @jest/expect, by the way!)

  2. Currently jest-mock has these utility types: Mocked, MockedClass, MockedFunction, MockedObject and I pulled one more from @types/jestSpiedFunction. Have to write type test to figure out what they all do and if there is no overlap.

(Another obvious overlap is jest.mocked() function. I am not a big fan of it, to be honest (; That’s another topic. Perhaps it is enough to focus on utility types first.)

Test plan

The usual: more type tests and green CI.

@SimenB
Copy link
Member

SimenB commented Feb 22, 2022

@mrazauskas what's the status here? 🙂

EDIT: Oh, #12435 I guess. Same question for that one then, I guess 😀

@mrazauskas
Copy link
Contributor Author

Good question. I am finishing type tests for Mock Functions (almost there!) and then will move on with refactoring.

@mrazauskas mrazauskas closed this Feb 23, 2022
@mrazauskas
Copy link
Contributor Author

Hm.. I did not close this. Had to reset the branch, because there was no need to rebase. I pushed and that’s it. Funny ;D

@SimenB
Copy link
Member

SimenB commented Feb 23, 2022

github closes if there is no diff against target branch

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants