react-native-navigation的迁移库

e2e.ios.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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_Detox build \
  15. -project playground.xcodeproj \
  16. -sdk iphonesimulator \
  17. -derivedDataPath ./DerivedData/playground \
  18. GCC_PREPROCESSOR_DEFINITIONS="DEBUG=1 RCT_DEBUG=1 RCT_DEV=1 RCT_NSASSERT=1"`);
  19. }
  20. function e2e() {
  21. try {
  22. kill(`detox-server`);
  23. cp.exec(`./node_modules/.bin/detox-server > ./detox-server.log 2>&1`);
  24. exec(`BABEL_ENV=test ./node_modules/mocha/bin/mocha e2e --recursive --compilers js:babel-register`);
  25. } finally {
  26. kill(`detox-server`);
  27. //kill(`Simulator`);
  28. //kill(`CoreSimulator`);
  29. exec(`cat ./detox-server.log`);
  30. exec(`rm -f ./detox-server.log`);
  31. exec(`sleep 5`);
  32. }
  33. }
  34. function run() {
  35. buildProjForDetox();
  36. e2e();
  37. }
  38. run();