Skip to content

Commit

Permalink
[LOCAL] fix e2e local testing script post metro-config
Browse files Browse the repository at this point in the history
  • Loading branch information
kelset committed Mar 30, 2023
1 parent 8beed6a commit 392a843
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions scripts/test-e2e-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"');
Expand All @@ -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`,
);
Expand All @@ -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(
Expand Down
8 changes: 3 additions & 5 deletions scripts/testing-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 392a843

Please sign in to comment.