react-native-navigation的迁移库

test-snapshot.js 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const includes = require('lodash/includes');
  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. runAndroidSnapshotTests();
  8. } else {
  9. runIosSnapshotTests();
  10. }
  11. }
  12. function runAndroidSnapshotTests() {
  13. }
  14. function runIosSnapshotTests() {
  15. exec.execSync('npm run build');
  16. exec.execSync('npm run pod-install');
  17. testTarget('SnapshotTests', 'iPhone 11');
  18. }
  19. function testTarget(scheme, device, OS = 'latest') {
  20. const conf = release ? `Release` : `Debug`;
  21. exec.execSync(`cd ./playground/ios &&
  22. RCT_NO_LAUNCH_PACKAGER=true
  23. xcodebuild build build-for-testing
  24. -scheme "${scheme}"
  25. -workspace playground.xcworkspace
  26. -sdk iphonesimulator
  27. -configuration ${conf}
  28. -derivedDataPath ./DerivedData/playground
  29. -quiet
  30. -UseModernBuildSystem=NO
  31. ONLY_ACTIVE_ARCH=YES`);
  32. exec.execSync(`cd ./playground/ios &&
  33. RCT_NO_LAUNCH_PACKAGER=true
  34. xcodebuild test-without-building
  35. -scheme "${scheme}"
  36. -workspace playground.xcworkspace
  37. -sdk iphonesimulator
  38. -configuration ${conf}
  39. -destination 'platform=iOS Simulator,name=${device},OS=${OS}'
  40. -derivedDataPath ./DerivedData/playground
  41. ONLY_ACTIVE_ARCH=YES`);
  42. }
  43. run();