react-native-navigation的迁移库

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