-
-
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
Fix unhandled error when a bad revision is provided to changedSince
#7112
Conversation
changedSince
…gedSince`, for git
…gedSince`, for hg
Codecov Report
@@ Coverage Diff @@
## master #7112 +/- ##
==========================================
- Coverage 66.67% 66.62% -0.06%
==========================================
Files 253 253
Lines 10597 10607 +10
Branches 3 4 +1
==========================================
+ Hits 7066 7067 +1
- Misses 3530 3539 +9
Partials 1 1
Continue to review full report at Codecov.
|
|
||
console.error(`\n\n${errorMsg}\n`); | ||
|
||
process.exit(0); |
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.
it should exit with code 1, not 0
|
||
process.exit(0); | ||
|
||
return []; |
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.
do we need to return
after the process.exit
?
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.
It's mainly to pass the flow tests, though eslint also complained.
.filter(s => s !== '') | ||
.map(changedPath => path.resolve(cwd, changedPath)); | ||
} catch (e) { | ||
const errorMsg = e.message.split('\n')[1]; |
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.
Instead of doing this, you should use formatExecError
from https://github.com/facebook/jest/blob/8e6b34520517033be0cbd866ccd70b91cb237696/packages/jest-message-util/src/index.js#L102
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.
Thanks for tackling this! I left some inline comments 🙂
Oh, another thing. What do yu think about wrapping the invocations of these functions in https://github.com/facebook/jest/blob/8e6b34520517033be0cbd866ccd70b91cb237696/packages/jest-changed-files/src/index.js#L32-L48? Then it's enough to just change there instead of the same change in both EDIT: Even better might be to wrap here: https://github.com/facebook/jest/blob/8c86fe8aecfab1a8815c804f9d1dd539a7fe72f6/packages/jest-cli/src/getChangedFilesPromise.js#L23-L27 Then it's in |
Not exactly sure why, but wrapping l23-l27 w/ a try/catch didn't work – the error gets thrown anyway and it never catches. I went with the above suggestion to avoid the same changes in both |
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
This PR fixes #7025 – when a bad revision is passed to the
--changedSince
argument, causing an unhandled rejection error message. It will now output the error message from git/hg instead.Before:
After
Test plan
Updated integration tests.