Skip to content

fix: fail init when package manager is unavailable - #2849

Open
OskarEichler wants to merge 1 commit into
react-native-community:mainfrom
OskarEichler:codex/cli-init-missing-pm-exit
Open

fix: fail init when package manager is unavailable#2849
OskarEichler wants to merge 1 commit into
react-native-community:mainfrom
OskarEichler:codex/cli-init-missing-pm-exit

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

init --pm <name> currently logs an error and returns normally when the requested package manager is unavailable. That makes the CLI report a successful exit status even though no project was created.

Throw a CLIError instead so the existing command error handler reports the failure and exits nonzero. This changes only the unavailable explicit-package-manager path.

Test Plan

  • Added a regression test that requests an unavailable Yarn installation.
  • Verified the regression fails on unmodified main: the initialization promise resolves to undefined instead of rejecting.
  • Verified the focused regression passes with this change.
  • yarn test --selectProjects unit --runInBand: 57 suites passed, 315 tests passed, 1 todo, 62 snapshots passed.
  • yarn lint: passed with the two pre-existing warnings in openURLMiddleware.test.ts and commands/init/version.ts.
  • yarn build: passed for all packages.
  • git diff --check: passed.
  • The broad unfiltered Jest command also selects the repository's end-to-end project; it was stopped after its existing init TestProject --install-pods process waited indefinitely. No broad end-to-end result is claimed.

Checklist

  • Documentation is up to date (no documentation change is needed for correcting the exit status).
  • Follows commit message convention described in CONTRIBUTING.md.
  • For functional changes, my test plan has linked these CLI changes into a local react-native checkout (instructions).

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.

1 participant