Skip to content

Commit

Permalink
Fix test script when not using -c option
Browse files Browse the repository at this point in the history
  • Loading branch information
cipolleschi committed Nov 1, 2023
1 parent aed4aed commit 386a938
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions scripts/test-e2e-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const {exec, pushd, popd, pwd, cd, sed} = require('shelljs');
const updateTemplatePackage = require('./update-template-package');
const yargs = require('yargs');
const path = require('path');
const fs = require('fs');

const {
checkPackagerRunning,
Expand Down Expand Up @@ -184,24 +183,16 @@ async function testRNTestProject(circleCIArtifacts) {
// create the local npm package to feed the CLI

// base setup required (specular to publish-npm.js)
const baseVersion = require('../packages/react-native/package.json').version;

// in local testing, 1000.0.0 mean we are on main, every other case means we are
// working on a release version
const buildType = baseVersion !== '1000.0.0' ? 'release' : 'dry-run';
const shortCommit = exec('git rev-parse HEAD', {silent: true})
.toString()
.trim()
.slice(0, 9);

// we need to add the unique timestamp to avoid npm/yarn to use some local caches
const dateIdentifier = new Date()
.toISOString()
.slice(0, -8)
.replace(/[-:]/g, '')
.replace(/[T]/g, '-');

const releaseVersion = `1000.0.0-${shortCommit}`;
const buildType = 'dry-run';

// Prepare some variables for later use
const repoRoot = pwd();
Expand All @@ -212,6 +203,7 @@ async function testRNTestProject(circleCIArtifacts) {
circleCIArtifacts != null
? path.join(circleCIArtifacts.baseTmpPath(), 'maven-local')
: '/private/tmp/maven-local';

const hermesPath = await prepareArtifacts(
circleCIArtifacts,
mavenLocalPath,
Expand All @@ -234,9 +226,16 @@ async function testRNTestProject(circleCIArtifacts) {
cd('RNTestProject');
exec('yarn install');

// When using CircleCI artifacts, the CI will zip maven local into a
// /tmp/maven-local subfolder struct.
// When we generate the project manually, there is no such structure.
const expandedMavenLocal =
circleCIArtifacts == null
? mavenLocalPath
: `${mavenLocalPath}/tmp/maven-local`;
// need to do this here so that Android will be properly setup either way
exec(
`echo "react.internal.mavenLocalRepo=${mavenLocalPath}/tmp/maven-local" >> android/gradle.properties`,
`echo "react.internal.mavenLocalRepo=${expandedMavenLocal}" >> android/gradle.properties`,
);

// Update gradle properties to set Hermes as false
Expand Down

0 comments on commit 386a938

Please sign in to comment.