react-native-navigation的迁移库

12345678910111213141516171819202122232425262728293031
  1. const _ = require('lodash');
  2. const exec = require('shell-utils').exec;
  3. const android = _.includes(process.argv, '--android');
  4. const release = _.includes(process.argv, '--release');
  5. const skipBuild = _.includes(process.argv, '--skipBuild');
  6. const headless = _.includes(process.argv, '--headless');
  7. const multi = _.includes(process.argv, '--multi');
  8. run();
  9. function run() {
  10. const platform = android ? `android` : `ios`;
  11. const prefix = android ? `android.emu` : `ios.sim`;
  12. const suffix = release ? `release` : `debug`;
  13. const configuration = `${prefix}.${suffix}`;
  14. const cleanup = process.env.CI ? `--cleanup` : ``;
  15. const headless$ = android ? headless ? `--headless` : `` : ``;
  16. const workers = multi ? 3 : 1;
  17. if (platform === 'android') {
  18. const sdkmanager = '/usr/local/share/android-sdk/tools/bin/sdkmanager';
  19. exec.execSync(`echo y | ${sdkmanager} --update && echo y | ${sdkmanager} --licenses`);
  20. }
  21. if (!skipBuild) {
  22. exec.execSync(`detox build --configuration ${configuration}`);
  23. }
  24. exec.execSync(`detox test --configuration ${configuration} --platform ${platform} ${cleanup} ${headless$} ${!android ? `-w ${workers}` : ``}`); //-f "ScreenStyle.test.js" --loglevel trace
  25. }