Skip to content

Commit

Permalink
Use packaged react-native in test-e2e-local script (#36703)
Browse files Browse the repository at this point in the history
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
<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[INTERNAL] [FIXED] - Use packaged react-native in test-e2e-local script

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

Pull Request resolved: #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

# Conflicts:
#	scripts/test-e2e-local.js
  • Loading branch information
fortmarek authored and kelset committed Mar 30, 2023
1 parent e137040 commit 5162e0b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/test-e2e-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,16 @@ if (argv.target === 'RNTester') {
localMavenPath,
);

// create locally the node module
exec('npm pack');

const localNodeTGZPath = `${repoRoot}/react-native-${releaseVersion}.tgz`;
exec(`node scripts/set-rn-template-version.js "file:${localNodeTGZPath}"`);

// create locally the node module
exec('npm pack');

pushd('/tmp/');
// need to avoid the pod install step - we'll do it later
exec(
`node ${repoRoot}/cli.js init RNTestProject --template ${repoRoot} --skip-install`,
`node ${repoRoot}/cli.js init RNTestProject --template ${localNodeTGZPath} --skip-install`,
);

cd('RNTestProject');
Expand Down

0 comments on commit 5162e0b

Please sign in to comment.