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
 const shellUtils = require('shell-utils');
2
 const shellUtils = require('shell-utils');
3
 const fs = require('fs');
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
 function testProject() {
13
 function testProject() {
6
   shellUtils.exec.execSync(`echo 'travis_fold:start:xcodeunit'`);
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
           cd ios && xcodebuild
23
           cd ios && xcodebuild
9
             test
24
             test
10
             -scheme "playground"
25
             -scheme "playground"
11
             -project playground.xcodeproj
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
   shellUtils.exec.execSync(`echo 'travis_fold:end:xcodeunit'`);
28
   shellUtils.exec.execSync(`echo 'travis_fold:end:xcodeunit'`);
21
 }
29
 }
22
 function hasXcpretty() {
30
 function hasXcpretty() {