I have a React Native project in which I have an eas.json file containing the following environments:
{
"build": {
"production": {
"node": "16.18.0",
"channel": "production-v2",
"env": {
"INSTABUG_SOURCEMAPS_UPLOAD_DISABLE": "true",
"EXPO_PUBLIC_API_URL": "url here",
"EXPO_PUBLIC_MS_URL": "url here",
"EXPO_PUBLIC_LEGACY_API_URL": "url here"
}
},
"stage": {
"extends": "production",
"channel": "stage-v2",
"env": {
"EXPO_PUBLIC_API_URL": "url here",
"EXPO_PUBLIC_MS_URL": "url here",
"EXPO_PUBLIC_LEGACY_API_URL": "url here"
}
},
"development": {
"extends": "stage",
"developmentClient": true,
"distribution": "internal",
"ios": {
"resourceClass": "m-medium"
}
},
"development-simulator": {
"extends": "development",
"ios": {
"simulator": true
}
}
}
}
The issue is that, in order to run my automated tests with Detox, I need to eject the project using the command: npx expo run:ios to create the iOS folder with the respective binaryPath.
The problem arises when I try to build targeting "stage." It builds successfully, but it does not target any of the environments set in eas.json manually through EAS Update.
My detox.config.js file is as follows:
/* eslint-disable */
module.exports = {
logger: {
level: process.env.CI ? 'debug' : undefined
},
testRunner: {
args: {
config: './e2e/jest.config.js',
maxWorkers: process.env.CI ? 2 : undefined,
_: ['e2e']
}
},
artifacts: {
plugins: {
log: process.env.CI ? 'failing' : undefined,
screenshot: process.env.CI ? 'failing' : undefined
}
},
apps: {
'ios.release': {
type: 'ios.app',
binaryPath:
'ios/build/Build/Products/Release-iphonesimulator/application.app',
build:
'export RCT_NO_LAUNCH_PACKAGER=true && \
xcodebuild \
-workspace ios/application.xcworkspace \
-UseNewBuildSystem=NO \
-scheme application \
-configuration Release \
-sdk iphonesimulator \
-derivedDataPath ios/build \
-quiet'
}
},
devices: {
simulator: {
type: 'ios.simulator',
headless: Boolean(process.env.CI),
device: {
type: 'iPhone 15 Pro Max'
}
}
},
configurations: {
'ios.sim.release': {
device: 'simulator',
app: 'ios.release',
}
}
};
I run everything with the following scripts in package.json:
"scripts": {
"e2e:build": "detox build -c ios.sim.release",
"e2e:test": "detox test -c ios.sim.release",
"e2e": "yarn e2e:build && yarn e2e:test"
}
How can I make my Detox build target "stage"?
Thanks!
I tried to set the environment variables in the "configurations" like this:
configurations: {
'ios.sim.release': {
device: 'simulator',
app: 'ios.release',
launchArgs: {
detoxE2EConfiguration: 'ios.sim.release',
},
env: {
"EXPO_PUBLIC_API_URL": "url here",
"EXPO_PUBLIC_MS_URL": "url here",
"EXPO_PUBLIC_LEGACY_API_URL": "url here",
},
}
}
However, the build fails. On the other hand, if I don't specify anything, the build is successful but does not target any of those mentioned environments.