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

Put asserts on various assert functions. #69364

Merged
merged 1 commit into from May 2, 2024

Conversation

bmeurer
Copy link
Contributor

@bmeurer bmeurer commented Apr 15, 2024

This was battle-tested in Chrome DevTools now, and adds a bunch of asserts onto various functions on the assert function (as well as the assert function itself) to help with type narrowing in unit tests when using Chai.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code (we have patched the asserts into @types/chai (a slightly older version) for Chrome DevTools).
  • Add or edit tests to reflect the change (the chai-test.ts contains a new test suite for type narrowing).
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run pnpm test <package to test>.

If changing an existing definition:

Why?

This is a reland with a bugfix and some additions of #68780, where this time we have battle-tested it in Chrome DevTools first, and we're now ready and confident in upstreaming these changes.

@sheetalkamat @weswigham can you take a look again please?

This was battle-tested in Chrome DevTools now, and adds a bunch of
`asserts` onto various functions on the `assert` function (as well
as the `assert` function itself) to help with type narrowing in
unit tests when using Chai.
@bmeurer bmeurer requested a review from Bartvds as a code owner April 15, 2024 18:24
@typescript-bot
Copy link
Contributor

typescript-bot commented Apr 15, 2024

@bmeurer 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

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": 69364,
  "author": "bmeurer",
  "headCommitOid": "f3382ddae1d1e028c92f56946d313849f13f07c6",
  "mergeBaseOid": "da49c537cc32dc8148150f783fcfa28a8ff29856",
  "lastPushDate": "2024-04-15T18:24:26.000Z",
  "lastActivityDate": "2024-05-02T12:57:38.000Z",
  "mergeOfferDate": "2024-05-01T17:15:27.000Z",
  "mergeRequestDate": "2024-05-02T12:57:38.000Z",
  "mergeRequestUser": "bmeurer",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "chai",
      "kind": "edit",
      "files": [
        {
          "path": "types/chai/chai-tests.ts",
          "kind": "test"
        },
        {
          "path": "types/chai/index.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "Bartvds",
        "AGBrown",
        "olivr70",
        "mwistrand",
        "shaunluttin",
        "micksatana",
        "ErikSchierboom",
        "bparan",
        "CXuesong",
        "joeykilpatrick"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "rbuckton",
      "date": "2024-05-01T17:14:47.000Z",
      "isMaintainer": true
    }
  ],
  "mainBotCommentID": 2057547100,
  "ciResult": "pass"
}

@typescript-bot
Copy link
Contributor

🔔 @Bartvds @AGBrown @olivr70 @mwistrand @shaunluttin @micksatana @ErikSchierboom @bparan @CXuesong @joeykilpatrick — 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 moved this from Waiting for Code Reviews to Needs Maintainer Review in New Pull Request Status Board Apr 15, 2024
@bmeurer
Copy link
Contributor Author

bmeurer commented Apr 19, 2024

@sheetalkamat @weswigham friendly ping

@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 Apr 26, 2024
@typescript-bot
Copy link
Contributor

Re-ping @Bartvds, @AGBrown, @olivr70, @mwistrand, @shaunluttin, @micksatana, @ErikSchierboom, @bparan, @CXuesong, @joeykilpatrick:

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

Could someone please give it some attention? Thanks!

@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner and removed Unreviewed No one showed up to review this PR, so it'll be reviewed by a DT maintainer. labels May 1, 2024
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Author to Merge in New Pull Request Status Board May 1, 2024
@typescript-bot
Copy link
Contributor

@bmeurer: Everything looks good here. I am ready to merge this PR (at f3382dd) 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! ❤️

(@Bartvds, @AGBrown, @olivr70, @mwistrand, @shaunluttin, @micksatana, @ErikSchierboom, @bparan, @CXuesong, @joeykilpatrick: you can do this too.)

@bmeurer
Copy link
Contributor Author

bmeurer commented May 2, 2024

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 2, 2024
@typescript-bot typescript-bot merged commit c47f496 into DefinitelyTyped:master May 2, 2024
4 checks passed
@typescript-bot typescript-bot removed this from Recently Merged in New Pull Request Status Board May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Critical package Maintainer Approved 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

3 participants