-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[jest-util] Add ErrorWithStack class #7067
Conversation
Correct, but we should fix that. Or have like (Yes, that was a joke, but you know what I mean) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So good! A changelog entry in case it breaks some traces would be nice, other than that this looks great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so nice <3
@@ -0,0 +1,8 @@ | |||
export default class ErrorWithStack extends Error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mind adding preamble and flow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woops just added :)
@@ -0,0 +1,16 @@ | |||
import ErrorWithStack from '../error_with_stack'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be cool to flow it up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure it's worth adding flow to the test, it causes the following issue (which I'd have to disable):
[flow] Cannot assign `jest.fn()` to `Error.captureStackTrace` because property `captureStackTrace` is not writable. (error_with_stack.test.js:17:11)
Happy to add it though if you think we should :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine. It's just nice to have flow in tests too so you don't end up testing scenarios that are already covered/prevented by type checker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense, I've updated to use jest.spyOn
instead and added @flow
with no warnings 🎉
55e9188
to
7b73d44
Compare
Rebase on master and use for 49b2380? |
eb2c1f6
to
32afd4e
Compare
Codecov Report
@@ Coverage Diff @@
## master #7067 +/- ##
=========================================
+ Coverage 66.63% 66.7% +0.06%
=========================================
Files 251 252 +1
Lines 10542 10521 -21
Branches 3 3
=========================================
- Hits 7025 7018 -7
+ Misses 3516 3502 -14
Partials 1 1
Continue to review full report at Codecov.
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Removes the duplication of:
Motivation: see @SimenB's #7033 (comment)
Test plan
Notes
I've not updated the
expect
package with this change as I believe it cannot depend onjest-util
because of bundling for the browser, is this correct? cc/ @thymikee @rickhanlonii