react-native-navigation的迁移库

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 hasXcpretty() {
  12. try {
  13. return shellUtils.exec.execSyncRead(`which xcpretty`);
  14. } catch (e) {
  15. return false;
  16. }
  17. }
  18. function testProject() {
  19. shellUtils.exec.execSync(`echo 'travis_fold:start:xcodeunit'`);
  20. runWithXcprettyIfPossible(`RCT_NO_LAUNCH_PACKAGER=true
  21. cd ios && xcodebuild
  22. build build-for-testing
  23. -scheme "playground"
  24. -project playground.xcodeproj
  25. -sdk iphonesimulator
  26. -configuration Debug`);
  27. runWithXcprettyIfPossible(`RCT_NO_LAUNCH_PACKAGER=true
  28. cd ios && xcodebuild
  29. test-without-building
  30. -scheme "playground"
  31. -project playground.xcodeproj
  32. -destination 'platform=iOS Simulator,name=iPhone 7'`);
  33. shellUtils.exec.execSync(`echo 'travis_fold:end:xcodeunit'`);
  34. }
  35. function run() {
  36. testProject();
  37. }
  38. run();