Warm tip: This article is reproduced from stackoverflow.com, please click
azure-pipelines react-native detox

Issue with Detox (react native) running on Azure DevOps

发布于 2020-04-13 10:49:26

I have a few integration tests using Detox for React Native and they work fine using Release configuration on my local machine.

However, when I tried to set up the same configuration on Azure DevOps pipeline, it looks like the tests don't pass.

It looks like the Metro Bundler tries to run on new terminal window, but since it is an Azure Pipeline VM it is gets stuck? Then, the tests don't pass. Since it is a release version, maybe there is a way to block this event? The release version doesn't need the bundler to be running anyway.

My detox command:

detox build --configuration ios.sim.release

My detox configuration:

 "ios.sim.release": {
        "binaryPath": "ios/build/Build/Products/Release-iphonesimulator/raio.app",
        "build": "RN_SRC_EXT=e2e.js xcodebuild -workspace ios/raio.xcworkspace -scheme raio -configuration Release -sdk iphonesimulator -derivedDataPath ios/build",
        "type": "ios.simulator",
        "device": {
          "type": "iPhone 11 Pro"
        }
      }

Additional question: Does anyone know how running this xcodebuild line in the terminal makes the Metro bundler to start? Is there any custom Build Phase added to xcode for react native which triggers it?

Questioner
ddacrs
Viewed
112
Merlin Liang - MSFT 2020-02-04 13:57

Not sure whether this result you described is like this:

enter image description here

This is the limitation while you using Hosted MacOS agent ran with pipeline.

This daemon (Metro bundler) gets launched in separate terminal windows needs interactive mode, but the Hosted MacOS agents run as service. So not interactive mode this could be one reason why it is failing.

Also, until now, we haven't expand the feature on Hosted MacOS agents to support launch this daemon in separate terminal through build pipeline and keep it running as background process.

You'd better configure your self Mac-agent so that you have complete control over the machine environment.