Skip to content

run-ios command ignores the verbose option #1391

@liamjones

Description

@liamjones

Environment

info Fetching system and libraries information...
System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Memory: 1.47 GB / 16.00 GB
    Shell: 5.8 - /usr/local/bin/zsh
  Binaries:
    Node: 10.24.0 - /var/folders/h6/g6rldscd6h389g9w42_7k_jm0swv2d/T/yarn--1617537855315-0.38815081056993295/node
    Yarn: 1.22.10 - /var/folders/h6/g6rldscd6h389g9w42_7k_jm0swv2d/T/yarn--1617537855315-0.38815081056993295/yarn
    npm: 6.14.11 - ~/.nvm/versions/node/v10.24.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0 - /Users/liam.jones/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    Android SDK:
      API Levels: 23, 25, 26, 27, 28, 29
      Build Tools: 27.0.3, 28.0.3, 29.0.2, 29.0.3, 30.0.3, 31.0.0
      System Images: android-21 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-25 | Google Play Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1.3 4.1.3
    Xcode: 12.4/12D4e - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_282 - /usr/bin/javac
    Python: 3.9.2 - /usr/local/opt/python/libexec/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1
    react-native: 0.63.4 => 0.63.4
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Description

run-ios detects the presence of xcpretty and uses it if installed. The command-line help for the run-ios command states:

--verbose Do not use xcpretty even if installed

However, when run with the verbose option, xcpretty is still used.

I've dug into this a little, it looks like the verbose option is checked for in buildProject(), here: https://github.com/react-native-community/cli/blob/v4.14.0/packages/platform-ios/src/commands/runIOS/index.ts#L307

However, if I debug the command as it's running, verbose is undefined.

The issue seems to be coming from Command.prototype.opts() inside commander. Here it copies the values from properties on this (the Command) into result[key]: https://github.com/tj/commander.js/blob/v2.20.3/index.js#L779. This works for other options like packager (set via --no-packager). I can see packager, etc exist on this for the working properties but for some reason this.verbose doesn't.

I've not been able to work out why this happens yet (nor if it's a problem in the cli or commander).

I've also created a fresh RN 0.64.0 project to check the behaviour is the same (and it is).

Reproducible Demo

  1. Install xcpretty
  2. Create RN project
  3. Run run-ios and note xcpretty formatted output
  4. Run run-ios --verbose and note xcpretty formatted output is still present

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions