Skip to content

Commit 341fbe5

Browse files
cipolleschihuntie
authored andcommitted
[RN][Release] Fix release testing script
1 parent 898e207 commit 341fbe5

File tree

2 files changed

+33
-21
lines changed

2 files changed

+33
-21
lines changed

scripts/e2e/init-template-e2e.js

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const {
2222
const {parseArgs} = require('@pkgjs/parseargs');
2323
const chalk = require('chalk');
2424
const {execSync} = require('child_process');
25+
const {promises: fs} = require('fs');
26+
const path = require('path');
2527

2628
const config = {
2729
options: {
@@ -64,6 +66,10 @@ async function main() {
6466
}
6567

6668
await initNewProjectFromSource(options);
69+
70+
// TODO(T179377112): Fix memory leak from `spawn` in `setupVerdaccio` (above
71+
// kill command does not wait for kill success).
72+
process.exit(0);
6773
}
6874

6975
async function initNewProjectFromSource(
@@ -119,48 +125,44 @@ async function initNewProjectFromSource(
119125
{
120126
// Avoid loading packages/react-native/react-native.config.js
121127
cwd: REPO_ROOT,
122-
stdio: verbose ? 'inherit' : [process.stderr],
128+
stdio: 'inherit',
123129
},
124130
);
125131
console.log('\nDone ✅');
126132

127133
console.log('Installing project dependencies');
128-
await runYarnUsingProxy(directory);
134+
await installProjectUsingProxy(directory);
129135
console.log('Done ✅');
130136
} catch (e) {
131137
console.log('Failed ❌');
132138
throw e;
133139
} finally {
134140
console.log(`Cleanup: Killing Verdaccio process (PID: ${verdaccioPid})`);
135-
execSync(`kill -9 ${verdaccioPid}`);
136-
console.log('Done ✅');
141+
try {
142+
execSync(`kill -9 ${verdaccioPid}`);
143+
console.log('Done ✅');
144+
} catch {
145+
console.warn('Failed to kill Verdaccio process');
146+
}
137147

138148
console.log('Cleanup: Removing Verdaccio storage directory');
139149
execSync(`rm -rf ${VERDACCIO_STORAGE_PATH}`);
140150
console.log('Done ✅');
141-
142-
// TODO(huntie): Fix memory leak from `spawn` in `setupVerdaccio` (above
143-
// kill command does not wait for kill success).
144-
process.exit(0);
145151
}
146152
}
147153

148-
async function runYarnUsingProxy(cwd /*: string */) {
154+
async function installProjectUsingProxy(cwd /*: string */) {
149155
const execOptions = {
150156
cwd,
151157
stdio: 'inherit',
152158
};
153-
execSync(
154-
`yarn config set npmRegistryServer "${VERDACCIO_SERVER_URL}"`,
155-
execOptions,
156-
);
157-
execSync(
158-
'yarn config set unsafeHttpWhitelist --json \'["localhost"]\'',
159-
execOptions,
160-
);
161159

162160
// TODO(huntie): Review pre-existing retry limit
163-
const success = await retry('yarn', execOptions, 3, 500, ['install']);
161+
const success = await retry('npm', execOptions, 3, 500, [
162+
'install',
163+
'--registry',
164+
VERDACCIO_SERVER_URL,
165+
]);
164166

165167
if (!success) {
166168
throw new Error('Failed to install project dependencies');

scripts/release-testing/test-e2e-local.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const {
2727
prepareArtifacts,
2828
setupCircleCIArtifacts,
2929
} = require('./utils/testing-utils');
30+
const chalk = require('chalk');
3031
const debug = require('debug')('test-e2e-local');
3132
const fs = require('fs');
3233
const path = require('path');
@@ -301,10 +302,10 @@ async function testRNTestProject(
301302
);
302303

303304
cd('..');
304-
exec('yarn ios');
305+
exec('npm run ios');
305306
} else {
306307
// android
307-
exec('yarn android');
308+
exec('npm run android');
308309
}
309310
popd();
310311
}
@@ -329,14 +330,23 @@ async function main() {
329330

330331
let circleCIArtifacts = await setupCircleCIArtifacts(
331332
// $FlowIgnoreError[prop-missing]
332-
argv.circleCIToken,
333+
argv.circleciToken,
333334
branchName,
334335
);
335336

336337
if (argv.target === 'RNTester') {
337338
await testRNTester(circleCIArtifacts, onReleaseBranch);
338339
} else {
339340
await testRNTestProject(circleCIArtifacts);
341+
342+
console.warn(
343+
chalk.yellow(`
344+
================================================================================
345+
NOTE: Verdaccio may still be running on after this script has finished. Please
346+
Force Quit via Activity Monitor.
347+
================================================================================
348+
`),
349+
);
340350
}
341351
}
342352

0 commit comments

Comments
 (0)