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] Add types for toHaveDisplayValue #44385

Merged

Conversation

berickson1
Copy link
Contributor

@berickson1 berickson1 commented Apr 30, 2020

Fixes #44361
Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • [s] Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If changing an existing definition:

  • Provide a URL to documentation or source code which provides context for the suggested changes: https://github.com/testing-library/jest-dom#tohavedisplayvalue
  • 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.
  • Include tests for your changes
  • 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 Where is Travis? Popular package This PR affects a popular package (as counted by NPM download counts). labels Apr 30, 2020
@typescript-bot
Copy link
Contributor

typescript-bot commented Apr 30, 2020

@berickson1 Thank you for submitting this PR!

Code Reviews

Because you edited one package and updated the tests (👏), I can help you merge this PR once someone else signs off on it.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Most recent commit is approved by type definition owners or DT maintainers

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": 44385,
  "author": "berickson1",
  "owners": [
    "gnapse",
    "jgoz",
    "smacpherson64"
  ],
  "dangerLevel": "ScopedAndTested",
  "headCommitAbbrOid": "30da26c",
  "headCommitOid": "30da26cf53f3713c0d4a812b67c5eb55d407486c",
  "mergeIsRequested": true,
  "stalenessInDays": 6,
  "lastCommitDate": "2020-05-12T00:33:09.000Z",
  "reopenedDate": "2020-05-12T00:28:40.000Z",
  "lastCommentDate": "2020-05-18T04:54:44.000Z",
  "reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/44385/files",
  "hasMergeConflict": false,
  "authorIsOwner": false,
  "isFirstContribution": false,
  "popularityLevel": "Popular",
  "anyPackageIsNew": false,
  "packages": [
    "testing-library__jest-dom"
  ],
  "files": [
    {
      "filePath": "types/testing-library__jest-dom/index.d.ts",
      "kind": "definition",
      "package": "testing-library__jest-dom"
    },
    {
      "filePath": "types/testing-library__jest-dom/test/testing-library__jest-dom-global-tests.ts",
      "kind": "test",
      "package": "testing-library__jest-dom"
    }
  ],
  "hasDismissedReview": false,
  "travisResult": "pass",
  "lastReviewDate": "2020-05-18T04:30:00.000Z",
  "reviewersWithStaleReviews": [
    {
      "reviewedAbbrOid": "3a7d361",
      "reviewer": "jgoz",
      "date": "2020-05-08T19:46:30Z"
    },
    {
      "reviewedAbbrOid": "7568be7",
      "reviewer": "majesticuser",
      "date": "2020-05-02T10:33:55Z"
    },
    {
      "reviewedAbbrOid": "68aefa0",
      "reviewer": "orta",
      "date": "2020-04-30T17:07:25Z"
    }
  ],
  "approvalFlags": 2,
  "isChangesRequested": false
}

@typescript-bot typescript-bot moved this from Other to Needs Author Action in New Pull Request Status Board Apr 30, 2020
@typescript-bot typescript-bot moved this from Other to Needs Author Action in New Pull Request Status Board Apr 30, 2020
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board Apr 30, 2020
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board Apr 30, 2020
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board Apr 30, 2020
* @see
* [testing-library/jest-dom#tohavedisplayvalue](https:github.com/testing-library/jest-dom#tohavedisplayvalue)
*/
toHaveDisplayValue(value?: string | string[]): R;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice work on those docs!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy/pasted from their github docs, like the above examples :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's the best way to be, my first DT PR were the exact same for Jest: #14345

Choose a reason for hiding this comment

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

The case toHaveDisplayValue() without an argument does not work. I get the following error:
TypeError: Cannot read property 'toString' of undefined

Also see the jest-dom documentation: https://github.com/testing-library/jest-dom#tohavedisplayvalue

@berickson1
Copy link
Contributor Author

I don't use this library, only creating for from github issue request where I was (incorrectly) mentioned. I asked @majesticuser to help validate

@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 #44385 diff
Batch compilation
Memory usage (MiB) 83.2 72.1 -13.3%
Type count 11309 11313 0%
Assignability cache size 34788 34788 0%
Language service
Samples taken 242 263 +9%
Identifiers in tests 242 263 +9%
getCompletionsAtPosition
    Mean duration (ms) 337.7 333.5 -1.2%
    Mean CV 11.0% 10.9%
    Worst duration (ms) 425.1 414.9 -2.4%
    Worst identifier toHaveValue toBeChecked
getQuickInfoAtPosition
    Mean duration (ms) 322.9 317.3 -1.7%
    Mean CV 10.8% 9.9% -8.3%
    Worst duration (ms) 397.9 418.4 +5.1%
    Worst identifier toHaveStyle expect

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 Apr 30, 2020
@majesticuser
Copy link

I don't use this library, only creating for from github issue request where I was (incorrectly) mentioned. I asked @majesticuser to help validate

Hi, I'am sorry that I thought you was the author of this type definitions. And thank you very much for fixing the issue. I tried out your type definition file.
The case toHaveDisplayValue()without an argument does not work. I get the following error:
TypeError: Cannot read property 'toString' of undefined

Also see the jest-dom documentation: https://github.com/testing-library/jest-dom#tohavedisplayvalue

@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). and removed Popular package This PR affects a popular package (as counted by NPM download counts). labels Apr 30, 2020
@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.

* @see
* [testing-library/jest-dom#tohavedisplayvalue](https:github.com/testing-library/jest-dom#tohavedisplayvalue)
*/
toHaveDisplayValue(value?: string | string[]): R;

Choose a reason for hiding this comment

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

The case toHaveDisplayValue() without an argument does not work. I get the following error:
TypeError: Cannot read property 'toString' of undefined

Also see the jest-dom documentation: https://github.com/testing-library/jest-dom#tohavedisplayvalue

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

@berickson1 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 or comments. If you disagree with the reviewer's comments, you can "dismiss" the review using GitHub's review UI. Thank you!

1 similar comment
@typescript-bot
Copy link
Contributor

@berickson1 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 or comments. If you disagree with the reviewer's comments, you can "dismiss" the review using GitHub's review UI. Thank you!

@berickson1
Copy link
Contributor Author

I don't use this library, only creating for from github issue request where I was (incorrectly) mentioned. I asked @majesticuser to help validate

Hi, I'am sorry that I thought you was the author of this type definitions. And thank you very much for fixing the issue. I tried out your type definition file.
The case toHaveDisplayValue()without an argument does not work. I get the following error:
TypeError: Cannot read property 'toString' of undefined

Also see the jest-dom documentation: https://github.com/testing-library/jest-dom#tohavedisplayvalue

Give it another shot - I updated the definition

@typescript-bot typescript-bot removed the Revision needed This PR needs code changes before it can be merged. label May 1, 2020
@berickson1 berickson1 deleted the berickson1/jestDomTypes branch May 11, 2020 23:51
@zikaari
Copy link
Contributor

zikaari commented May 11, 2020

@berickson1 can you please explain how typings for toHaveDescription void typings for toHaveDisplayValue?

@berickson1 berickson1 restored the berickson1/jestDomTypes branch May 12, 2020 00:28
@berickson1 berickson1 reopened this May 12, 2020
@typescript-bot typescript-bot added this to Waiting for Code Reviews in New Pull Request Status Board May 12, 2020
@berickson1
Copy link
Contributor Author

berickson1 commented May 12, 2020

@berickson1 can you please explain how typings for toHaveDescription void typings for toHaveDisplayValue?

The github conflict markers for the same file segment looked like it was the same change + I misread the title - re-opening and fixing conflicts

@typescript-bot typescript-bot added the Has Merge Conflict This PR can't be merged because it has a merge conflict. The author needs to update it. label May 12, 2020
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Author Action in New Pull Request Status Board May 12, 2020
@typescript-bot
Copy link
Contributor

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

@typescript-bot typescript-bot removed the Has Merge Conflict This PR can't be merged because it has a merge conflict. The author needs to update it. label May 12, 2020
@typescript-bot typescript-bot moved this from Needs Author Action to Waiting for Code Reviews in New Pull Request Status Board May 12, 2020
@typescript-bot typescript-bot moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board May 16, 2020
@typescript-bot
Copy link
Contributor

@gnapse, @jgoz, @majesticuser, @orta 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 added 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 labels May 18, 2020
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Author to Merge in New Pull Request Status Board May 18, 2020
@typescript-bot
Copy link
Contributor

@jgoz, @majesticuser, @orta 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?

@berickson1
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 May 18, 2020
@typescript-bot typescript-bot merged commit 11fabf5 into DefinitelyTyped:master May 18, 2020
jjballano-qatium pushed a commit to jjballano-qatium/DefinitelyTyped that referenced this pull request Jun 16, 2020
…s for toHaveDisplayValue by @berickson1

* [@testing-library/jest-dom] Add types for toHaveDisplayValue

* Update as per PR comments

* Update incorrect comment

* Auto-commit github suggestion

Co-authored-by: Ernesto García <gnapse@gmail.com>

* Add tests from PR suggestions

* Fix compiler errors from 3df262

Co-authored-by: Ernesto García <gnapse@gmail.com>
@typescript-bot typescript-bot removed this from Recently Merged in New Pull Request Status Board Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Owner Approved A listed owner of this package signed off on the pull request. Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. Popular package This PR affects a popular package (as counted by NPM download counts). 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.

jest-dom type definition for toHaveDisplayValue() is missing
7 participants