react-native-navigation的迁移库

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const _ = require('lodash');
  2. const exec = require('shell-utils').exec;
  3. const release = _.includes(process.argv, 'release');
  4. function buildProjForDetox() {
  5. const scheme = release ? `playground_release` : `playground`;
  6. const conf = release ? `Release` : `Debug`;
  7. exec.execSync(`cd ./playground/ios &&
  8. RCT_NO_LAUNCH_PACKAGER=true
  9. xcodebuild build
  10. -scheme ${scheme}
  11. -project playground.xcodeproj
  12. -sdk iphonesimulator
  13. -configuration ${conf}
  14. -derivedDataPath ./DerivedData/playground
  15. ONLY_ACTIVE_ARCH=YES`);
  16. }
  17. function runDetoxUsingMocha() {
  18. const detoxAppBuildPath = `playground/ios/DerivedData/playground/Build/Products/${release ? 'Release' : 'Debug'}-iphonesimulator/playground.app`;
  19. exec.execSync(`detoxAppBuildPath="${detoxAppBuildPath}"
  20. ./node_modules/mocha/bin/mocha e2e
  21. --timeout ${5 * 60 * 1000}
  22. --recursive
  23. --bail
  24. ${process.env.CI ? '--cleanup' : ''}`);
  25. }
  26. function e2e() {
  27. runDetoxUsingMocha();
  28. }
  29. function run() {
  30. if (!exec.which(`fbsimctl`)) {
  31. throw new Error(`fbsimctl must be installed: "brew tap facebook/fb && brew install fbsimctl"`);
  32. }
  33. buildProjForDetox();
  34. e2e();
  35. }
  36. run();