react-native-navigation的迁移库

test-unit.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 ? 'testReactNative60ReleaseUnitTest' : 'testReactNative60DebugUnitTest';
  14. if (android && process.env.JENKINS_CI) {
  15. const sdkmanager = '/usr/local/share/android-sdk/tools/bin/sdkmanager';
  16. exec.execSync(`yes | ${sdkmanager} --licenses`);
  17. // exec.execSync(`echo y | ${sdkmanager} --update && echo y | ${sdkmanager} --licenses`);
  18. }
  19. exec.execSync(`cd lib/android && ./gradlew ${conf}`);
  20. }
  21. function runIosUnitTests() {
  22. const conf = release ? `Release` : `Debug`;
  23. exec.execSync(`cd ./playground/ios &&
  24. RCT_NO_LAUNCH_PACKAGER=true
  25. xcodebuild build build-for-testing
  26. -scheme "ReactNativeNavigation"
  27. -project playground.xcodeproj
  28. -sdk iphonesimulator
  29. -configuration ${conf}
  30. -derivedDataPath ./playground/ios/DerivedData/playground
  31. -quiet
  32. -UseModernBuildSystem=NO
  33. ONLY_ACTIVE_ARCH=YES`);
  34. exec.execSync(`cd ./playground/ios &&
  35. RCT_NO_LAUNCH_PACKAGER=true
  36. xcodebuild test-without-building
  37. -scheme "ReactNativeNavigation"
  38. -project playground.xcodeproj
  39. -sdk iphonesimulator
  40. -configuration ${conf}
  41. -destination 'platform=iOS Simulator,name=iPhone 11'
  42. -derivedDataPath ./playground/ios/DerivedData/playground
  43. ONLY_ACTIVE_ARCH=YES`);
  44. }
  45. run();