react-native-navigation的迁移库

test.unit.ios.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. const _ = require('lodash');
  2. const exec = require('shell-utils').exec;
  3. const release = _.includes(process.argv, '--release');
  4. function run() {
  5. const conf = release ? `Release` : `Debug`;
  6. execWithXcprettyIfPossible(`cd ./playground/ios &&
  7. RCT_NO_LAUNCH_PACKAGER=true
  8. xcodebuild build build-for-testing
  9. -scheme "ReactNativeNavigation"
  10. -project playground.xcodeproj
  11. -sdk iphonesimulator
  12. -configuration ${conf}
  13. -derivedDataPath ./DerivedData/playground
  14. ONLY_ACTIVE_ARCH=YES`);
  15. execWithXcprettyIfPossible(`cd ./playground/ios &&
  16. RCT_NO_LAUNCH_PACKAGER=true
  17. xcodebuild test-without-building
  18. -scheme "ReactNativeNavigation"
  19. -project playground.xcodeproj
  20. -sdk iphonesimulator
  21. -configuration ${conf}
  22. -destination 'platform=iOS Simulator,name=iPhone 7'
  23. -derivedDataPath ./DerivedData/playground
  24. ONLY_ACTIVE_ARCH=YES`);
  25. }
  26. function execWithXcprettyIfPossible(cmd) {
  27. if (exec.which('xcpretty')) {
  28. exec.execSync(`${cmd} | xcpretty`);
  29. } else {
  30. exec.execSync(cmd);
  31. }
  32. }
  33. run();