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] Fix options type of jest.mocked() helper method #62259

Merged
merged 2 commits into from Sep 15, 2022
Merged

[jest] Fix options type of jest.mocked() helper method #62259

merged 2 commits into from Sep 15, 2022

Conversation

mrazauskas
Copy link
Contributor

Please fill in this template.

Select one of these and delete the others:

If changing an existing definition:

Summary

Jest 29 shipped with reworked implementation jest.mocked() helper method. The second argument is now a bag of options instead of a boolean. The API is documented and I think it makes sense to keep the implementation in @types/jest aligned. First, users can follow the documentation of Jest. Second, currently this is one of the reasons of the error described in jestjs/jest#13199.

Probably it is also a good idea to align the types in order to prevent similar issues in the future.

@typescript-bot
Copy link
Contributor

typescript-bot commented Sep 14, 2022

@mrazauskas Thank you for submitting this PR!

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

Once every item on this list is checked, I'll ask you for permission to merge and publish the changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 62259,
  "author": "mrazauskas",
  "headCommitOid": "784a9457299e4e87742711877f0ba60a4cd874b6",
  "mergeBaseOid": "ed7808e5c43d43ec53ae641cdd4bff6e14d0038e",
  "lastPushDate": "2022-09-14T18:43:19.000Z",
  "lastActivityDate": "2022-09-15T03:50:42.000Z",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "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",
        "pawfa",
        "regevbr",
        "gerkindev",
        "domdomegg"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "r3nya",
      "date": "2022-09-15T03:50:42.000Z",
      "isMaintainer": false
    },
    {
      "type": "approved",
      "reviewer": "domdomegg",
      "date": "2022-09-15T00:52:00.000Z",
      "isMaintainer": false
    }
  ],
  "mainBotCommentID": 1247157495,
  "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 @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 Sep 14, 2022
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in New Pull Request Status Board Sep 14, 2022
@typescript-bot
Copy link
Contributor

@mrazauskas 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.

@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Sep 14, 2022
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board Sep 14, 2022
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Sep 14, 2022
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.

LGTM, thanks 🙌

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Sep 15, 2022
@sandersn sandersn merged commit 9fff010 into DefinitelyTyped:master Sep 15, 2022
@typescript-bot typescript-bot removed this from Needs Maintainer Review in New Pull Request Status Board Sep 15, 2022
@mrazauskas mrazauskas deleted the fix-jest.mock-options branch September 16, 2022 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Critical package Owner Approved A listed owner of this package signed off on the pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants