diff --git a/scripts/test-e2e-local.js b/scripts/test-e2e-local.js index 915d089c190854..19f21a12f76a61 100644 --- a/scripts/test-e2e-local.js +++ b/scripts/test-e2e-local.js @@ -99,7 +99,7 @@ if (argv.target === 'RNTester') { // if everything succeeded so far, we can launch Metro and the app // start the Metro server in a separate window - launchPackagerInSeparateWindow(); + launchPackagerInSeparateWindow(pwd()); // launch the app on iOS simulator exec('npx react-native run-ios --scheme RNTester --simulator "iPhone 14"'); @@ -114,7 +114,7 @@ if (argv.target === 'RNTester') { } version of RNTester Android with the new Architecture enabled`, ); exec( - `./gradlew :packages:rn-tester:android:app:${ + `../../gradlew :packages:rn-tester:android:app:${ argv.hermes ? 'installHermesDebug' : 'installJscDebug' } --quiet`, ); @@ -125,7 +125,7 @@ if (argv.target === 'RNTester') { // if everything succeeded so far, we can launch Metro and the app // start the Metro server in a separate window - launchPackagerInSeparateWindow(); + launchPackagerInSeparateWindow(pwd()); // launch the app exec( diff --git a/scripts/testing-utils.js b/scripts/testing-utils.js index 543a345e0dfe17..a7d48b7d8b73a2 100644 --- a/scripts/testing-utils.js +++ b/scripts/testing-utils.js @@ -97,11 +97,9 @@ function isPackagerRunning( } // this is a very limited implementation of how this should work -// literally, this is macos only -// a more robust implementation can be found here: -// https://github.com/react-native-community/cli/blob/7c003f2b1d9d80ec5c167614ba533a004272c685/packages/cli-platform-android/src/commands/runAndroid/index.ts#L195 -function launchPackagerInSeparateWindow() { - exec("open -a 'Terminal' ./packages/react-native/scripts/packager.sh"); +function launchPackagerInSeparateWindow(folderPath) { + const command = `tell application "Terminal" to do script "cd ${folderPath} && yarn start"`; + exec(`osascript -e '${command}'`); } module.exports = {