react-native-navigation的迁移库

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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(`RCT_NO_LAUNCH_PACKAGER=true
  8. cd ./playground/ios && xcodebuild
  9. build
  10. -scheme ${scheme}
  11. -project playground.xcodeproj
  12. -sdk iphonesimulator
  13. -configuration ${conf}
  14. -derivedDataPath ./DerivedData/playground
  15. ONLY_ACTIVE_ARCH=YES && echo $?`);
  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. BABEL_ENV=test
  21. ./node_modules/mocha/bin/mocha e2e
  22. --timeout ${5 * 60 * 1000}
  23. --recursive
  24. --bail`);
  25. }
  26. function e2e() { //eslint-disable-line
  27. try {
  28. runDetoxUsingMocha();
  29. } finally {
  30. if (process.env.CI) {
  31. exec.kill(`Simulator`);
  32. exec.kill(`CoreSimulator`);
  33. exec.execSync(`sleep 5`);
  34. }
  35. }
  36. }
  37. function run() {
  38. if (!exec.which(`fbsimctl`)) {
  39. throw new Error(`fbsimctl must be installed: "brew tap facebook/fb && brew install fbsimctl"`);
  40. }
  41. buildProjForDetox();
  42. e2e();
  43. }
  44. run();