Skip to content

Commit

Permalink
Remove process.exit calls from publish-npm and throw errors instead (#…
Browse files Browse the repository at this point in the history
…43039)

Summary:
Pull Request resolved: #43039

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

fbshipit-source-id: 9293bb9a95430c50052db36c0e6f6c1ba348107f
  • Loading branch information
lunaleaps authored and pull[bot] committed Apr 19, 2024
1 parent 152c6e8 commit b6173e6
Show file tree
Hide file tree
Showing 3 changed files with 278 additions and 186 deletions.
Loading

0 comments on commit b6173e6

Please sign in to comment.