react-native-navigation的迁移库

test.unit.ios.js 1.1KB

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