GCh*_*ass 3 react-native react-native-config detox
当我在反应本机应用程序中运行排毒测试时,我想传递环境变量:
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/myapp.app",
"build": "export IS_DETOX=true && xcodebuild -workspace ios/myapp.xcworkspace -scheme my app -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"device": {
"type": "iPhone 11 Pro"
}
}
Run Code Online (Sandbox Code Playgroud)
我已经安装了react-native-config。但是当我运行排毒测试时,变量 IS_DETOX 在 JS 中未定义。
谢谢
我正在设置环境变量而不使用export.
我的所有 .env 变量都存储在 config 文件夹中,我可以为不同的配置加载不同的环境文件。
iOS系统
"ios.sim.release": {
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/Clim8Invest.app",
"build": "ENVFILE=config/.env.acceptance xcodebuild -workspace ios/Clim8Invest.xcworkspace -scheme Clim8Invest -configuration Release -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"device": {
"type": "iPhone 11"
}
},
Run Code Online (Sandbox Code Playgroud)
安卓
"android.emu.debug.e2e": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ENVFILE=../config/.env.e2e ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"device": {
"avdName": "Nexus_5X_A"
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4359 次 |
| 最近记录: |