react-native-navigation的迁移库

e2e.ios.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const cp = require('child_process');
  2. function exec(cmd) {
  3. cp.execSync(cmd, {stdio: ['inherit', 'inherit', 'inherit']});
  4. }
  5. function execSilent(cmd) {
  6. cp.execSync(cmd, {stdio: ['inherit', 'ignore', 'inherit']});
  7. }
  8. function kill(process) {
  9. execSilent(`pkill -f "${process}" || true`);
  10. }
  11. function buildProjForDetox() {
  12. exec(`RCT_NO_LAUNCH_PACKAGER=true \
  13. cd ios && xcodebuild \
  14. -scheme playground_release_Detox build \
  15. -project playground.xcodeproj \
  16. -sdk iphonesimulator \
  17. -derivedDataPath ./DerivedData/playground`);
  18. }
  19. function e2e() {
  20. try {
  21. kill(`detox-server`);
  22. cp.exec(`./node_modules/.bin/detox-server > ./detox-server.log 2>&1`);
  23. exec(`BABEL_ENV=test ./node_modules/mocha/bin/mocha e2e --recursive --compilers js:babel-register`);
  24. } finally {
  25. kill(`detox-server`);
  26. kill(`Simulator`);
  27. kill(`CoreSimulator`);
  28. exec(`cat ./detox-server.log`);
  29. exec(`rm -f ./detox-server.log`);
  30. exec(`sleep 5`);
  31. }
  32. }
  33. function run() {
  34. buildProjForDetox();
  35. e2e();
  36. }
  37. run();