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

[@testing-library/jest-dom] Allow all elements #49707

Closed
wants to merge 1 commit into from

Conversation

nickserv
Copy link
Contributor

@nickserv nickserv commented Nov 20, 2020

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes: React Testing Library API types prevent usage of SVG elements testing-library/react-testing-library#830
  • If this PR brings the type definitions up to date with a new version of the JS library, update the version number in the header.
  • If you are making substantial changes, consider adding a tslint.json containing { "extends": "dtslint/dt.json" }. If for reason the any rule need to be disabled, disable it for that line using // tslint:disable-next-line [ruleName] and not for whole package so that the need for disabling can be reviewed.

@typescript-bot typescript-bot added Critical package Untested Change This PR does not touch tests labels Nov 20, 2020
@typescript-bot
Copy link
Contributor

typescript-bot commented Nov 20, 2020

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

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ❌ Only a DT maintainer can approve changes without tests

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

Inactive

This PR has been inactive for 23 days — it is considered nearly abandoned!


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 49707,
  "author": "nickmccurdy",
  "headCommitOid": "abfb39f187b6cc60fa7f93f2fc7abeeea102a5ca",
  "lastPushDate": "2020-11-20T21:11:16.000Z",
  "lastActivityDate": "2020-12-24T02:14:15.000Z",
  "maintainerBlessed": false,
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "testing-library__jest-dom",
      "kind": "edit",
      "files": [
        {
          "path": "types/testing-library__jest-dom/index.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "gnapse",
        "jgoz",
        "smacpherson64"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "changereq",
      "reviewer": "jgoz",
      "date": "2020-11-20T21:31:10.000Z"
    }
  ],
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

🔔 @gnapse @jgoz @smacpherson64 — 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.

Copy link
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.

Hmm, I don't believe this change reflects the actual runtime behavior in jest-dom. Both of these methods use checkHtmlElement which explicitly verifies that they are instances of either HTMLElement or SVGElement.

The linked issue in react-testing-library discussed allowing elements such as <circle> to be used directly, which are not instances of either of these two prototypes.

Therefore, I think the correct order of operations would be to first open a PR in jest-dom to make these assertions compatible with the non-root SVG elements, and then reflect that in the typings.

@typescript-bot typescript-bot added the Revision needed This PR needs code changes before it can be merged. label Nov 20, 2020
@typescript-bot
Copy link
Contributor

typescript-bot commented Nov 20, 2020

@nickmccurdy 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!

@nickserv nickserv closed this Nov 20, 2020
@typescript-bot
Copy link
Contributor

👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings.

Let’s review the numbers, shall we?

Comparison details 📊
master #49707 diff
Batch compilation
Memory usage (MiB) 83.0 81.6 -1.7%
Type count 11518 11516 0%
Assignability cache size 3721 3721 0%
Language service
Samples taken 312 312 0%
Identifiers in tests 312 312 0%
getCompletionsAtPosition
    Mean duration (ms) 324.7 325.8 +0.3%
    Mean CV 10.7% 11.0%
    Worst duration (ms) 420.2 431.3 +2.6%
    Worst identifier not toHaveTextContent
getQuickInfoAtPosition
    Mean duration (ms) 326.1 326.0 0.0%
    Mean CV 10.0% 9.9%
    Worst duration (ms) 426.8 408.7 -4.2%
    Worst identifier expect toHaveTextContent

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added the Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. label Nov 20, 2020
@nickserv
Copy link
Contributor Author

nickserv commented Nov 30, 2020

I thought we could go without this, but it seems like Jest DOM's runtime type checking has gotten out of sync with other type updates we've made in the organization. To remedy this I've opened testing-library/jest-dom#313 upstream. Once that's fixed I may update this pull request.

@nickserv nickserv reopened this Nov 30, 2020
@typescript-bot typescript-bot added the Abandoned This PR had no activity for a long time, and is considered abandoned label Dec 24, 2020
@typescript-bot
Copy link
Contributor

@nickmccurdy I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed in a week if the issues aren't addressed.

@nickserv
Copy link
Contributor Author

Intentionally keeping this open as it's blocked by testing-library/jest-dom#313

@typescript-bot typescript-bot removed the Abandoned This PR had no activity for a long time, and is considered abandoned label Dec 24, 2020
@typescript-bot typescript-bot added the Abandoned This PR had no activity for a long time, and is considered abandoned label Jan 16, 2021
@typescript-bot
Copy link
Contributor

@nickmccurdy I haven't seen any activity on this PR in more than three weeks, and it still has problems that prevent it from being merged. The PR will be closed on Feb 15 (in a week) if the issues aren't addressed.

@nickserv
Copy link
Contributor Author

This is still blocked but I'll close it temporarily to stop the bot from replying.

@nickserv nickserv closed this Jan 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Abandoned This PR had no activity for a long time, and is considered abandoned Critical package Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. Revision needed This PR needs code changes before it can be merged. Untested Change This PR does not touch tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants