Fix Maestro E2E runtime environment (#11247)
This commit is contained in:
@@ -136,7 +136,7 @@ wait_for_port 1986 "the E2E mock-server manager"
|
|||||||
|
|
||||||
phase "Starting Metro"
|
phase "Starting Metro"
|
||||||
EXPO_PUBLIC_ENV=e2e \
|
EXPO_PUBLIC_ENV=e2e \
|
||||||
NODE_ENV=test \
|
NODE_ENV=development \
|
||||||
RN_SRC_EXT=e2e.ts,e2e.tsx \
|
RN_SRC_EXT=e2e.ts,e2e.tsx \
|
||||||
pnpm exec expo start --dev-client --clear --port 8081 \
|
pnpm exec expo start --dev-client --clear --port 8081 \
|
||||||
>"$artifact_dir/metro.log" 2>&1 &
|
>"$artifact_dir/metro.log" 2>&1 &
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir -p artifacts/ios
|
mkdir -p artifacts/ios
|
||||||
echo "Installing dependencies" > artifacts/ios/phase.txt
|
echo "Installing dependencies" > artifacts/ios/phase.txt
|
||||||
cp .env.example .env.test
|
cp .env.example .env.development
|
||||||
cp google-services.json.example google-services.json
|
cp google-services.json.example google-services.json
|
||||||
|
|
||||||
- name: Set up Expo project
|
- name: Set up Expo project
|
||||||
@@ -167,7 +167,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir -p artifacts/android
|
mkdir -p artifacts/android
|
||||||
echo "Installing dependencies" > artifacts/android/phase.txt
|
echo "Installing dependencies" > artifacts/android/phase.txt
|
||||||
cp .env.example .env.test
|
cp .env.example .env.development
|
||||||
cp google-services.json.example google-services.json
|
cp google-services.json.example google-services.json
|
||||||
|
|
||||||
- name: Set up Expo project
|
- name: Set up Expo project
|
||||||
|
|||||||
+13
-11
@@ -1,6 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* @param {import("@babel/core").ConfigAPI} api
|
||||||
|
* @returns {import("@babel/core").InputOptions}
|
||||||
|
*/
|
||||||
module.exports = function (api) {
|
module.exports = function (api) {
|
||||||
api.cache(true)
|
|
||||||
const isTestEnv = process.env.NODE_ENV === 'test'
|
|
||||||
return {
|
return {
|
||||||
presets: [
|
presets: [
|
||||||
[
|
[
|
||||||
@@ -10,7 +12,7 @@ module.exports = function (api) {
|
|||||||
native: {
|
native: {
|
||||||
// Disable ESM -> CJS compilation because Metro takes care of it.
|
// Disable ESM -> CJS compilation because Metro takes care of it.
|
||||||
// However, we need it in Jest tests since those run without Metro.
|
// However, we need it in Jest tests since those run without Metro.
|
||||||
disableImportExportTransform: !isTestEnv,
|
disableImportExportTransform: !api.env('test'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -29,15 +31,15 @@ module.exports = function (api) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
|
// cannot use `env` field because it will put them after
|
||||||
|
// the `react-native-worklets/plugin` plugin
|
||||||
|
...(api.env('test')
|
||||||
|
? ['@babel/plugin-transform-class-static-block']
|
||||||
|
: []),
|
||||||
|
...(api.env('production') ? ['transform-remove-console'] : []),
|
||||||
|
|
||||||
'react-native-worklets/plugin', // NOTE: this plugin MUST be last
|
'react-native-worklets/plugin', // NOTE: this plugin MUST be last
|
||||||
],
|
],
|
||||||
env: {
|
|
||||||
production: {
|
|
||||||
plugins: ['transform-remove-console'],
|
|
||||||
},
|
|
||||||
test: {
|
|
||||||
plugins: ['@babel/plugin-transform-class-static-block'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
},
|
},
|
||||||
"env": {
|
"env": {
|
||||||
"EXPO_PUBLIC_ENV": "e2e",
|
"EXPO_PUBLIC_ENV": "e2e",
|
||||||
"NODE_ENV": "test",
|
"NODE_ENV": "development",
|
||||||
"RN_SRC_EXT": "e2e.ts,e2e.tsx"
|
"RN_SRC_EXT": "e2e.ts,e2e.tsx"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
+3
-3
@@ -67,9 +67,9 @@
|
|||||||
"typecheck:android": "tsc --project ./tsconfig.check.android.json",
|
"typecheck:android": "tsc --project ./tsconfig.check.android.json",
|
||||||
"typecheck:web": "tsc --project ./tsconfig.check.web.json",
|
"typecheck:web": "tsc --project ./tsconfig.check.web.json",
|
||||||
"e2e:mock-server": "cd dev-env && pnpm start",
|
"e2e:mock-server": "cd dev-env && pnpm start",
|
||||||
"e2e:build": "EXPO_PUBLIC_ENV=e2e NODE_ENV=test RN_SRC_EXT=e2e.ts,e2e.tsx expo run:ios",
|
"e2e:build": "EXPO_PUBLIC_ENV=e2e NODE_ENV=development RN_SRC_EXT=e2e.ts,e2e.tsx expo run:ios",
|
||||||
"e2e:build-android": "EXPO_PUBLIC_ENV=e2e NODE_ENV=test RN_SRC_EXT=e2e.ts,e2e.tsx expo run:android",
|
"e2e:build-android": "EXPO_PUBLIC_ENV=e2e NODE_ENV=development RN_SRC_EXT=e2e.ts,e2e.tsx expo run:android",
|
||||||
"e2e:start": "EXPO_PUBLIC_ENV=e2e NODE_ENV=test RN_SRC_EXT=e2e.ts,e2e.tsx expo start -c",
|
"e2e:start": "EXPO_PUBLIC_ENV=e2e NODE_ENV=development RN_SRC_EXT=e2e.ts,e2e.tsx expo start -c",
|
||||||
"e2e:run": "maestro test",
|
"e2e:run": "maestro test",
|
||||||
"perf:test": "NODE_ENV=test maestro test",
|
"perf:test": "NODE_ENV=test maestro test",
|
||||||
"perf:test:run": "NODE_ENV=test maestro test __e2e__/perf-test.yml",
|
"perf:test:run": "NODE_ENV=test maestro test __e2e__/perf-test.yml",
|
||||||
|
|||||||
Reference in New Issue
Block a user