Skip to content

[@testing-library/jest-dom] Fix matchers type making the global expect unsafe#66247

Closed
kryops wants to merge 1 commit intoDefinitelyTyped:masterfrom
kryops:testing-library-jest-dom_fix-any
Closed

[@testing-library/jest-dom] Fix matchers type making the global expect unsafe#66247
kryops wants to merge 1 commit intoDefinitelyTyped:masterfrom
kryops:testing-library-jest-dom_fix-any

Conversation

@kryops
Copy link
Copy Markdown
Contributor

@kryops kryops commented Aug 1, 2023

Please fill in this template.

Select one of these and delete the others:

If changing an existing definition:

@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Aug 1, 2023

@kryops 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": 66247,
  "author": "kryops",
  "headCommitOid": "c941395183fd9d1f0f1d893158f1eff732dbf430",
  "mergeBaseOid": "6be113476bef803465cd7e1a96a14a96154351f3",
  "lastPushDate": "2023-08-01T12:41:22.000Z",
  "lastActivityDate": "2023-08-15T14:21:35.000Z",
  "hasMergeConflict": true,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "testing-library__jest-dom",
      "kind": "edit",
      "files": [
        {
          "path": "types/testing-library__jest-dom/matchers.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/testing-library__jest-dom/test/testing-library__jest-dom-extend-matchers-tests.ts",
          "kind": "test"
        },
        {
          "path": "types/testing-library__jest-dom/test/testing-library__jest-dom-global-tests.ts",
          "kind": "test"
        }
      ],
      "owners": [
        "gnapse",
        "jgoz",
        "smacpherson64",
        "AndrewLeedham"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "AndrewLeedham",
      "date": "2023-08-15T14:21:35.000Z",
      "isMaintainer": false
    }
  ],
  "mainBotCommentID": 1660236738,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Copy Markdown
Contributor

🔔 @gnapse @jgoz @smacpherson64 @AndrewLeedham — 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 Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. label Aug 12, 2023
@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Aug 12, 2023

Re-ping @gnapse, @jgoz, @smacpherson64:

This PR has been out for over a week, yet I haven't seen any reviews.

Could someone please give it some attention? Thanks!

customExpect(element).toHaveErrorMessage(/invalid time/i);
customExpect(element).toHaveErrorMessage(expect.stringContaining('Invalid time'));

customExpect(element).not.toBeInTheDOM();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@kryops How come you removed all the .not test cases?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The testing library types actually do not contain not, only the Jest types do.

These tests were only green because the types mapped every unkown property to any before, but I don't think they really made sense.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah I see, because of the customExpect. Looks like the jest suite is still testing .not so this looks good :)

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Aug 15, 2023
Copy link
Copy Markdown
Contributor

@jgoz jgoz left a comment

Choose a reason for hiding this comment

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

Apologies for the delay. I've been meaning to chime in here that I was in the process of moving the typings for jest-dom back into the main repo: testing-library/jest-dom#511

I haven't put much thought into this particular change, but for jest-dom v6, it will need to be applied in the main repository too.

@typescript-bot typescript-bot added Has Merge Conflict This PR can't be merged because it has a merge conflict. The author needs to update it. and removed Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. labels Aug 15, 2023
@typescript-bot
Copy link
Copy Markdown
Contributor

@kryops Unfortunately, this pull request currently has a merge conflict 😥. Please update your PR branch to be up-to-date with respect to master. Have a nice day!

@kryops
Copy link
Copy Markdown
Contributor Author

kryops commented Aug 16, 2023

@jgoz thanks for the heads-up, closing in favor of testing-library/jest-dom#513

@kryops kryops closed this Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Critical package Has Merge Conflict This PR can't be merged because it has a merge conflict. The author needs to update it. 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.

4 participants