-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Remove process.exit calls and throw exception instead #43039
Closed
Closed
Conversation
This file contains 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
facebook-github-bot
added
the
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
label
Feb 15, 2024
This pull request was exported from Phabricator. Differential Revision: D53792754 |
Base commit: 2091400 |
lunaleaps
added a commit
to lunaleaps/react-native
that referenced
this pull request
Feb 15, 2024
…acebook#43039) Summary: Changelog: [Internal] - `publish-npm.js` is a [script we call in our CI](https://www.internalfb.com/code/fbsource/[c0b8566ac0d66c2c0282eeb597bfb54bedf757c6]/xplat/js/react-native-github/.circleci/configurations/jobs.yml?lines=1243) to publish the react-native package and others. Currently, the script leverages `exit/process.exit` to terminate early in a couple of places which makes the code hard to test because our tests don't truly early exit when `exit/process.exit` is called. This change removes any explicit `exit` calls and instead leverages the uncaught error to terminate the process and set the non-zero exit code. This makes our tests more accurate to the real control flow of the script. I've also updated the tests to better capture what we're actually testing by mocking at a higher level. Reviewed By: cipolleschi Differential Revision: D53792754
lunaleaps
force-pushed
the
export-D53792754
branch
from
February 15, 2024 17:05
20fc9d1
to
ff1d744
Compare
This pull request was exported from Phabricator. Differential Revision: D53792754 |
lunaleaps
added a commit
to lunaleaps/react-native
that referenced
this pull request
Feb 15, 2024
…acebook#43039) Summary: Changelog: [Internal] - `publish-npm.js` is a [script we call in our CI](https://www.internalfb.com/code/fbsource/[c0b8566ac0d66c2c0282eeb597bfb54bedf757c6]/xplat/js/react-native-github/.circleci/configurations/jobs.yml?lines=1243) to publish the react-native package and others. Currently, the script leverages `exit/process.exit` to terminate early in a couple of places which makes the code hard to test because our tests don't truly early exit when `exit/process.exit` is called. This change removes any explicit `exit` calls and instead leverages the uncaught error to terminate the process and set the non-zero exit code. This makes our tests more accurate to the real control flow of the script. I've also updated the tests to better capture what we're actually testing by mocking at a higher level. Reviewed By: cipolleschi Differential Revision: D53792754
lunaleaps
force-pushed
the
export-D53792754
branch
from
February 15, 2024 17:27
ff1d744
to
8241ef0
Compare
This pull request was exported from Phabricator. Differential Revision: D53792754 |
…acebook#43039) Summary: Changelog: [Internal] - `publish-npm.js` is a [script we call in our CI](https://www.internalfb.com/code/fbsource/[c0b8566ac0d66c2c0282eeb597bfb54bedf757c6]/xplat/js/react-native-github/.circleci/configurations/jobs.yml?lines=1243) to publish the react-native package and others. Currently, the script leverages `exit/process.exit` to terminate early in a couple of places which makes the code hard to test because our tests don't truly early exit when `exit/process.exit` is called. This change removes any explicit `exit` calls and instead leverages the uncaught error to terminate the process and set the non-zero exit code. This makes our tests more accurate to the real control flow of the script. I've also updated the tests to better capture what we're actually testing by mocking at a higher level. Reviewed By: cipolleschi Differential Revision: D53792754
lunaleaps
force-pushed
the
export-D53792754
branch
from
February 15, 2024 18:48
8241ef0
to
d9a1533
Compare
This pull request was exported from Phabricator. Differential Revision: D53792754 |
This pull request has been merged in d6a440e. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
Merged
This PR has been merged.
p: Facebook
Partner: Facebook
Partner
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.
Summary:
Changelog: [Internal] -
publish-npm.js
is a script we call in our CI to publish the react-native package and others.Currently, the script leverages
exit/process.exit
to terminate early in a couple of places which makes the code hard to test because our tests don't truly early exit whenexit/process.exit
is called.This change removes any explicit
exit
calls and instead leverages the uncaught error to terminate the process and set the non-zero exit code. This makes our tests more accurate to the real control flow of the script.I've also updated the tests to better capture what we're actually testing by mocking at a higher level.
Differential Revision: D53792754