123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- const cp = require('child_process');
-
- function exec(cmd) {
- cp.execSync(cmd, {stdio: ['inherit', 'inherit', 'inherit']});
- }
-
- function execSilent(cmd) {
- cp.execSync(cmd, {stdio: ['inherit', 'ignore', 'inherit']});
- }
-
- function kill(process) {
- execSilent(`pkill -f "${process}" || true`);
- }
-
- function buildProjForDetox() {
- exec(`RCT_NO_LAUNCH_PACKAGER=true \
- cd ios && xcodebuild \
- -scheme playground_release_Detox build \
- -project playground.xcodeproj \
- -sdk iphonesimulator \
- -derivedDataPath ./DerivedData/playground`);
- }
-
- function e2e() {
- try {
- kill(`detox-server`);
- cp.exec(`./node_modules/.bin/detox-server > ./detox-server.log 2>&1`);
- exec(`BABEL_ENV=test ./node_modules/mocha/bin/mocha e2e --recursive --compilers js:babel-register`);
- } finally {
- kill(`detox-server`);
- kill(`Simulator`);
- kill(`CoreSimulator`);
- exec(`cat ./detox-server.log`);
- exec(`rm -f ./detox-server.log`);
- exec(`sleep 5`);
- }
- }
-
- function run() {
- buildProjForDetox();
- e2e();
- }
-
- run();
|