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

fix: silently failing test in watch.test.js #1690

Merged
merged 1 commit into from May 5, 2022

Conversation

zubhav
Copy link
Contributor

@zubhav zubhav commented May 5, 2022

What kind of change does this PR introduce?
Fixes a silently failing test in watch.test.js

Did you add tests for your changes?
The fix was a change to a test itself

Summary
The test in concern was using .catch() to assert that an error was thrown. However, if the logic of the function was changed and a Promise did not reject, this test would pass as it wouldn't invoke .catch().

By using Jest's .reject, we are able to assert that the Promise rejected as well as checking the error itself.

Does this PR introduce a breaking change?
No

@zubhav zubhav requested a review from a team as a code owner May 5, 2022 08:13
@changeset-bot
Copy link

changeset-bot bot commented May 5, 2022

⚠️ No Changeset found

Latest commit: df3588c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Member

@rschristian rschristian left a comment

Choose a reason for hiding this comment

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

Cheers, good spot.

Thanks for fixing my awful spelling too

@rschristian rschristian merged commit 6c6316e into preactjs:master May 5, 2022
@zubhav zubhav deleted the fix/change-watch-port-test branch May 5, 2022 08:45
@zubhav
Copy link
Contributor Author

zubhav commented May 5, 2022

👍 Noticed there were some lint warnings in the demo app section. Is it worth me raising a PR to add eslint-ignore comment for these lines?

Screenshot 2022-05-05 at 09 45 29

@rschristian
Copy link
Member

rschristian commented May 5, 2022

If you're willing, sure. Definitely happy to merge improvements.

Could also just convert that to a variable assignment instead (and update the test).

Edit: I'm pretty surprised someone found this issue. Did you have an issue with port assignment? Just curious, a PR to fix poor tests is quite a rare pleasure to receive.

@zubhav
Copy link
Contributor Author

zubhav commented May 5, 2022

@rschristian Cool, I'll prob raise a PR later for those warnings.

Had no issue with port assignment. Cloned this repo to browse around and look for anywhere I could help. Let me know if you need a hand on anything else, I'll do my best to help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants