Improve and clarify error for missing scheme file #2599
Merged
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
This improves and clarifies the error message printed by React Native CLI when the shared scheme file is missing.
Problem
I recently attempted to run an app with
yarn ios
, and received an error:Subsequently I spent 1h+ digging through the code and local caches etc trying to figure out where that mysterious trailing apostrophe originated from (note, it mentions
MyApp'
is available, but it is looking forMyApp
). It was nowhere to be found. As it turned out, the issue was with how RN CLI formatted the error.Additionally, the existing error message makes it sound like the first reference to "MyApp" is directly related to or equivalent to the second reference. That's not the case. The first reference represents the shared scheme file it is trying to load, while the second reference is a list of schemes declared in the project configuration.
Lastly, the error message (as well as an internal variable in code) contains the term "schema", which should be "scheme". Minor difference, but to be consistent with the Apple/iOS ecosystem only "scheme" should be used.
Solution
'
(apostrophe) from error messageTest Plan
First, I created a new test file for
getBuildConfigurationFromXcScheme
, ensuring 100% line coverage in the existing file. Then, in two additional commits, I made the changes, ensuring the tests will continue to run. When reviewing the PR commit-by-commit, it will be easiest to see.Before
After