From 758dec82fd663b9aaaa55807fe80c4d083e69467 Mon Sep 17 00:00:00 2001 From: fortmarek Date: Wed, 29 Mar 2023 10:21:44 -0700 Subject: [PATCH] Use packaged react-native in test-e2e-local script (#36703) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: The current `test-e2e-local` script had two bugs: - On [this](https://github.com/facebook/react-native/blob/c1c22ebacc4097ce56f19385161ebb23ee1624b3/scripts/test-e2e-local.js#L219) line we were initializing a new RN project with the packed `react-native` created [here](https://github.com/facebook/react-native/blob/c1c22ebacc4097ce56f19385161ebb23ee1624b3/scripts/test-e2e-local.js#L211) - We were updating the local RN version after running `npm pack` [here](https://github.com/facebook/react-native/blob/c1c22ebacc4097ce56f19385161ebb23ee1624b3/scripts/test-e2e-local.js#L214). This meant that the version inside the packaged `react-native-xyz.tgz` was not updated since we ran `pack` before updating it. This was fine since the `init` command was using the local `react-native` repository instead of the packed version. ## Changelog: [INTERNAL] [FIXED] - Use packaged react-native in test-e2e-local script Pull Request resolved: https://github.com/facebook/react-native/pull/36703 Test Plan: - Run `yarn test-e2e-local -t RNTestProject -p Android`. The command should succeed. I am not completely sure how to double check that we are using the packed version. Locally, I have a `fsmonitor--daemon.ipc` in my `react-native/.git` that can't be copied. The `.git` folder would be copied only when `cli.js init` was called with the whole repository – which is how I found out about the issue in the first place. Reviewed By: hoxyq Differential Revision: D44504599 Pulled By: cipolleschi fbshipit-source-id: e57e2858bab46d4f978eed3cbaf3e504138594b8 --- scripts/test-e2e-local.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/test-e2e-local.js b/scripts/test-e2e-local.js index e70e9eb8d36d00..e1bc00433fef3a 100644 --- a/scripts/test-e2e-local.js +++ b/scripts/test-e2e-local.js @@ -207,16 +207,16 @@ if (argv.target === 'RNTester') { localMavenPath, ); - // create locally the node module - exec('npm pack', {cwd: reactNativePackagePath}); - const localNodeTGZPath = `${reactNativePackagePath}/react-native-${releaseVersion}.tgz`; exec(`node scripts/set-rn-template-version.js "file:${localNodeTGZPath}"`); + // create locally the node module + exec('npm pack', {cwd: reactNativePackagePath}); + pushd('/tmp/'); // need to avoid the pod install step - we'll do it later exec( - `node ${reactNativePackagePath}/cli.js init RNTestProject --template ${repoRoot} --skip-install`, + `node ${reactNativePackagePath}/cli.js init RNTestProject --template ${localNodeTGZPath} --skip-install`, ); cd('RNTestProject');