react-native-navigation的迁移库

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. const _ = require('lodash');
  2. const shellUtils = require('shell-utils');
  3. const fs = require('fs');
  4. function runWithXcprettyIfPossible(cmd) {
  5. if (hasXcpretty()) {
  6. shellUtils.exec.execSync(`${cmd} | xcpretty && exit \${PIPESTATUS[0]}`);
  7. } else {
  8. shellUtils.exec.execSync(`${cmd}`);
  9. }
  10. }
  11. function testProject() {
  12. shellUtils.exec.execSync(`echo 'travis_fold:start:xcodeunit'`);
  13. runWithXcprettyIfPossible(`RCT_NO_LAUNCH_PACKAGER=true
  14. cd ios && xcodebuild
  15. build
  16. -scheme "playground"
  17. -project playground.xcodeproj
  18. -sdk iphonesimulator
  19. -configuration Debug`);
  20. runWithXcprettyIfPossible(`RCT_NO_LAUNCH_PACKAGER=true
  21. cd ios && xcodebuild
  22. test
  23. -scheme "playground"
  24. -project playground.xcodeproj
  25. -destination 'platform=iOS Simulator,name=iPhone 7'`);
  26. shellUtils.exec.execSync(`echo 'travis_fold:end:xcodeunit'`);
  27. }
  28. function hasXcpretty() {
  29. try {
  30. return shellUtils.exec.execSyncRead(`which xcpretty`);
  31. } catch (e) {
  32. return false;
  33. }
  34. }
  35. function run() {
  36. testProject();
  37. }
  38. run();