Browse Source

try to solve apple bug

Daniel Zlotin 8 years ago
parent
commit
91ed603d96
1 changed files with 17 additions and 9 deletions
  1. 17
    9
      playground/scripts/unit.ios.js

+ 17
- 9
playground/scripts/unit.ios.js View File

@@ -2,21 +2,29 @@ const _ = require('lodash');
2 2
 const shellUtils = require('shell-utils');
3 3
 const fs = require('fs');
4 4
 
5
+function runWithXcprettyIfPossible(cmd) {
6
+  if (hasXcpretty()) {
7
+    shellUtils.exec.execSync(`${cmd} | xcpretty && exit \${PIPESTATUS[0]}`);
8
+  } else {
9
+    shellUtils.exec.execSync(`${cmd}`);
10
+  }
11
+}
12
+
5 13
 function testProject() {
6 14
   shellUtils.exec.execSync(`echo 'travis_fold:start:xcodeunit'`);
7
-  const cmd = `RCT_NO_LAUNCH_PACKAGER=true
15
+  runWithXcprettyIfPossible(`RCT_NO_LAUNCH_PACKAGER=true
16
+          cd ios && xcodebuild
17
+            build
18
+            -scheme "playground"
19
+            -project playground.xcodeproj
20
+            -sdk iphonesimulator
21
+            -configuration Debug`);
22
+  runWithXcprettyIfPossible(`RCT_NO_LAUNCH_PACKAGER=true
8 23
           cd ios && xcodebuild
9 24
             test
10 25
             -scheme "playground"
11 26
             -project playground.xcodeproj
12
-            -destination 'platform=iOS Simulator,name=iPhone 7'
13
-            `;
14
-
15
-  // if (hasXcpretty()) {
16
-  //   shellUtils.exec.execSync(`${cmd} | xcpretty && exit \${PIPESTATUS[0]}`);
17
-  // } else {
18
-  shellUtils.exec.execSync(`${cmd}`);
19
-  // }
27
+            -destination 'platform=iOS Simulator,name=iPhone 7'`);
20 28
   shellUtils.exec.execSync(`echo 'travis_fold:end:xcodeunit'`);
21 29
 }
22 30
 function hasXcpretty() {