react-native-navigation的迁移库

test-unit.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 ? 'testReactNative57_5ReleaseUnitTest' : 'testReactNative57_5DebugUnitTest';
  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. -UseModernBuildSystem=NO
  28. ONLY_ACTIVE_ARCH=YES`);
  29. exec.execSync(`cd ./playground/ios &&
  30. RCT_NO_LAUNCH_PACKAGER=true
  31. xcodebuild test-without-building
  32. -scheme "ReactNativeNavigation"
  33. -project playground.xcodeproj
  34. -sdk iphonesimulator
  35. -configuration ${conf}
  36. -destination 'platform=iOS Simulator,name=iPhone X'
  37. -derivedDataPath ./DerivedData/playground
  38. ONLY_ACTIVE_ARCH=YES`);
  39. }
  40. run();