Use exception helpers instead of try catch #425
Merged
astarinmymind merged 4 commits intodevelopfrom Mar 23, 2021
Merged
Conversation
Gudahtt
previously approved these changes
Mar 22, 2021
| it('should timeout', async () => { | ||
| await expect( | ||
| util.safelyExecuteWithTimeout(() => { | ||
| return new Promise((res) => setTimeout(res, 800)); |
Member
There was a problem hiding this comment.
Not a blocker for this PR because it was already broken in this manner, but this isn't quite enough to test that this is working correctly.
For us to know the timeout was triggered, we'd have to ensure that something other than undefined would be called otherwise. e.g.
Suggested change
| return new Promise((res) => setTimeout(res, 800)); | |
| return new Promise((resolve) => setTimeout(() => resolve('No timeout!'), 800)); |
Contributor
Author
There was a problem hiding this comment.
Noted! I will fix this test in a different PR :)
Gudahtt
approved these changes
Mar 23, 2021
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
MajorLift
pushed a commit
that referenced
this pull request
Oct 11, 2023
Mrtenz
pushed a commit
that referenced
this pull request
Oct 16, 2025
Update dependencies that Socket warned about in #423 <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? Are there any issues or other links reviewers should consult to understand this pull request better? For instance: * Fixes #12345 * See: #67890 --> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Updates yarn.lock to bump several packages (e.g., cross-spawn 7.0.6, form-data 3.0.4, get-intrinsic 1.3.1) and add required transitive deps to address audits. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit a6eefaab549ac8b5980443e43b5c3a3b847682ab. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adopts this pattern for async tests when testing exceptions:
await expect(yourFunction()).rejects.toThrow()