react-native-navigation的迁移库

e2e.ios.js 998B

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 buildXcodeReleaseProj() {
  12. //exec(`RCT_NO_LAUNCH_PACKAGER=true cd ios && xcodebuild \
  13. //-scheme example_Detox clean build \
  14. //-project example.xcodeproj \
  15. //-destination "platform=iOS Simulator,name=iPhone 7,OS=10.1" \
  16. //-derivedDataPath ./DerivedData/example`);
  17. }
  18. function e2e() {
  19. kill(`detox-server`);
  20. try {
  21. cp.exec(`./node_modules/.bin/detox-server > ./detox-server.log 2>&1`);
  22. exec(`BABEL_ENV=test ./node_modules/mocha/bin/mocha e2e --opts ./e2e/mocha.opts`);
  23. } finally {
  24. kill(`detox-server`);
  25. kill(`Simulator`);
  26. kill(`CoreSimulator`);
  27. exec(`cat ./detox-server.log`);
  28. exec(`sleep 5`);
  29. }
  30. }
  31. function run() {
  32. buildXcodeReleaseProj();
  33. e2e();
  34. }
  35. run();