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

[jest] adding definitions for mocked function #57776

Merged
merged 8 commits into from Dec 30, 2021
Merged

[jest] adding definitions for mocked function #57776

merged 8 commits into from Dec 30, 2021

Conversation

k-rajat19
Copy link
Contributor

Please fill in this template.

Select one of these and delete the others:
If changing an existing definition:

#57716 jestjs/jest#12131

@typescript-bot
Copy link
Contributor

typescript-bot commented Dec 19, 2021

@k-rajat19 Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through.

This is a live comment which I will keep updated.

1 package in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Most recent commit is approved by a DT maintainer

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 57776,
  "author": "k-rajat19",
  "headCommitOid": "280655bdc093a54452e8d07e30193c6a86d17d55",
  "lastPushDate": "2021-12-22T06:47:01.000Z",
  "lastActivityDate": "2021-12-30T19:30:51.000Z",
  "mergeOfferDate": "2021-12-30T18:25:32.000Z",
  "mergeRequestDate": "2021-12-30T19:30:51.000Z",
  "mergeRequestUser": "k-rajat19",
  "hasMergeConflict": false,
  "isFirstContribution": true,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "jest",
      "kind": "edit",
      "files": [
        {
          "path": "types/jest/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/jest/jest-tests.ts",
          "kind": "test"
        }
      ],
      "owners": [
        "NoHomey",
        "jwbay",
        "asvetliakov",
        "alexjoverm",
        "epicallan",
        "ikatyang",
        "wsmd",
        "JamieMason",
        "douglasduteil",
        "ahnpnl",
        "UselessPickles",
        "r3nya",
        "hotell",
        "sebald",
        "andys8",
        "antoinebrault",
        "gstamac",
        "ExE-Boss",
        "quassnoi",
        "Belco90",
        "tonyhallett",
        "ycmjason",
        "devanshj",
        "pawfa",
        "regevbr",
        "gerkindev",
        "domdomegg"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "orta",
      "date": "2021-12-30T19:03:40.000Z",
      "isMaintainer": true
    },
    {
      "type": "approved",
      "reviewer": "peterblazejewicz",
      "date": "2021-12-30T18:24:55.000Z",
      "isMaintainer": true
    },
    {
      "type": "approved",
      "reviewer": "domdomegg",
      "date": "2021-12-23T18:25:49.000Z",
      "isMaintainer": false
    },
    {
      "type": "approved",
      "reviewer": "G-Rath",
      "date": "2021-12-22T06:57:11.000Z",
      "isMaintainer": false
    }
  ],
  "mainBotCommentID": 997369120,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

🔔 @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @ahnpnl @UselessPickles @r3nya @Hotell @sebald @andys8 @antoinebrault @gstamac @ExE-Boss @quassnoi @Belco90 @tonyhallett @ycmjason @devanshj @pawfa @regevbr @GerkinDev @domdomegg — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot typescript-bot added the The CI failed When GH Actions fails label Dec 19, 2021
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in New Pull Request Status Board Dec 19, 2021
@typescript-bot
Copy link
Contributor

@k-rajat19 The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

Note: builds which are failing do not end up on the list of PRs for the DT maintainers to review.

@k-rajat19 k-rajat19 marked this pull request as draft December 19, 2021 10:53
@k-rajat19 k-rajat19 mentioned this pull request Dec 19, 2021
8 tasks
Copy link
Contributor

@G-Rath G-Rath left a comment

Choose a reason for hiding this comment

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

We don't need to define the function ourselves, since it's exported by jest-mock so we can use that which I've done in #57775 - that way we don't have to be maintaining the types ourselves.

types/jest/index.d.ts Outdated Show resolved Hide resolved
@k-rajat19
Copy link
Contributor Author

k-rajat19 commented Dec 19, 2021

@G-Rath as i already worked on it so i am leaving this PR open for review by maintainers of DT . They can close this PR if they want :)

@k-rajat19 k-rajat19 marked this pull request as ready for review December 19, 2021 21:29
@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Dec 19, 2021
@typescript-bot
Copy link
Contributor

@G-Rath Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot typescript-bot moved this from Needs Author Action to Needs Maintainer Review in New Pull Request Status Board Dec 19, 2021
Copy link
Contributor

@G-Rath G-Rath left a comment

Choose a reason for hiding this comment

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

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Dec 19, 2021
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Needs Author Action in New Pull Request Status Board Dec 19, 2021
@typescript-bot
Copy link
Contributor

@k-rajat19 One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits. Thank you!

@k-rajat19
Copy link
Contributor Author

k-rajat19 commented Dec 20, 2021

I totally agree with what you have said above. I'm still confused that which is the better way of doing it 😅 (by looking at current scene in @types/jest) that's why I am not closing it.

@k-rajat19
Copy link
Contributor Author

@SimenB should I close this?

@SimenB
Copy link
Contributor

SimenB commented Dec 20, 2021

I'm not involved with maintaining @types/jest, so I have no opinion here.

Copy link
Contributor

@G-Rath G-Rath left a comment

Choose a reason for hiding this comment

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

Have requested a few changes, but overall this looks fine - it does introduce some mixed/duplicate types that we should try and resolve ASAP (e.g. jest-mock uses MockWithArgs to type our MockedFunction) but it should be easier to do that with these shipped as-is because codebases can choose which ones to use which'll make it easier to find where they're not compatible with each other.

types/jest/index.d.ts Outdated Show resolved Hide resolved
types/jest/v16/index.d.ts Outdated Show resolved Hide resolved
types/jest/index.d.ts Outdated Show resolved Hide resolved
types/jest/index.d.ts Outdated Show resolved Hide resolved
@typescript-bot typescript-bot added the Other Approved This PR was reviewed and signed-off by a community member. label Dec 21, 2021
Copy link
Contributor

@G-Rath G-Rath left a comment

Choose a reason for hiding this comment

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

Looks good - have left a couple of tidy up comments but they don't need to be actioned for this to be merged 🙂

@k-rajat19
Copy link
Contributor Author

Looks good - have left a couple of tidy up comments but they don't need to be actioned for this to be merged )
is this bot merged this PR ?

@typescript-bot typescript-bot removed the Other Approved This PR was reviewed and signed-off by a community member. label Dec 22, 2021
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Code Reviews in New Pull Request Status Board Dec 22, 2021
@typescript-bot
Copy link
Contributor

@G-Rath Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Dec 22, 2021
@typescript-bot typescript-bot added the Other Approved This PR was reviewed and signed-off by a community member. label Dec 22, 2021
Copy link
Contributor

@domdomegg domdomegg left a comment

Choose a reason for hiding this comment

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

Thank you @k-rajat19 and @G-Rath for your excellent contributions to this. These changes look good to me now.

As a side note, I'm very impressed by the high quality collaboration between you two, having read through your comments on this and #57775. Keep up the great work! :)

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Dec 23, 2021
@72636c 72636c mentioned this pull request Dec 29, 2021
1 task
@jameskerr
Copy link

Would love to see this merged! Thanks!

@k-rajat19
Copy link
Contributor Author

k-rajat19 commented Dec 30, 2021

ping @orta @sandersn @peterblazejewicz @andrewbranch :)

Copy link
Member

@peterblazejewicz peterblazejewicz left a comment

Choose a reason for hiding this comment

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

LGTM!

@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner labels Dec 30, 2021
@typescript-bot
Copy link
Contributor

@k-rajat19: Everything looks good here. I am ready to merge this PR (at 280655b) on your behalf whenever you think it's ready.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

(@NoHomey, @jwbay, @asvetliakov, @alexjoverm, @epicallan, @ikatyang, @wsmd, @JamieMason, @douglasduteil, @ahnpnl, @UselessPickles, @r3nya, @Hotell, @sebald, @andys8, @antoinebrault, @gstamac, @ExE-Boss, @quassnoi, @Belco90, @tonyhallett, @ycmjason, @devanshj, @pawfa, @regevbr, @GerkinDev, @domdomegg: you can do this too.)

@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Author to Merge in New Pull Request Status Board Dec 30, 2021
Copy link
Collaborator

@orta orta left a comment

Choose a reason for hiding this comment

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

All additions, and looks like what the linked runtime PR indicates - so looks reasonable to me

@k-rajat19
Copy link
Contributor Author

Ready to merge

@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Recently Merged in New Pull Request Status Board Dec 30, 2021
@typescript-bot typescript-bot merged commit d56d389 into DefinitelyTyped:master Dec 30, 2021
@typescript-bot typescript-bot removed this from Recently Merged in New Pull Request Status Board Dec 31, 2021
martin-badin pushed a commit to martin-badin/DefinitelyTyped that referenced this pull request Feb 23, 2022
…d` function by @k-rajat19

* mocked

* fixing jest-tests

* prettier

* removing prettier changes

* tslint

* making requested changes

* jest-tests

* removing comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Critical package Maintainer Approved Other Approved This PR was reviewed and signed-off by a community member. Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants