Skip to content

Commit 4a355fd

Browse files
huntiefacebook-github-bot
authored andcommitted
Fix release testing script
Summary: Various fixes/tweaks to the `test-e2e-local` script, impacted by recent changes, found during the release process: - Fix typo in variable name for `circleciToken` arg. - Relocate erroneously positioned `process.exit` call (a force exit around Verdaccio, which we will remove in future). - Add notice on exit around Verdaccio server not being killed successfully (to do in T179377112). - Switch from Yarn to npm for test project installation — Yarn 3 is not respecting `npmRegistryServer`, see yarnpkg/yarn#2508. Changelog: [Internal] Differential Revision: D53951606
1 parent 7fffe69 commit 4a355fd

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

scripts/e2e/init-template-e2e.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ async function main() {
6565
}
6666

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

7074
async function initNewProjectFromSource(
@@ -122,48 +126,43 @@ async function initNewProjectFromSource(
122126
{
123127
// Avoid loading packages/react-native/react-native.config.js
124128
cwd: REPO_ROOT,
125-
stdio: verbose ? 'inherit' : [process.stderr],
129+
stdio: 'inherit',
126130
},
127131
);
128132
console.log('\nDone ✅');
129133

130134
console.log('Installing project dependencies');
131-
await runYarnUsingProxy(directory);
135+
await installProjectUsingProxy(directory);
132136
console.log('Done ✅');
133137
} catch (e) {
134138
console.log('Failed ❌');
135139
throw e;
136140
} finally {
137141
console.log(`Cleanup: Killing Verdaccio process (PID: ${verdaccioPid})`);
138-
execSync(`kill -9 ${verdaccioPid}`);
139-
console.log('Done ✅');
140-
142+
try {
143+
execSync(`kill -9 ${verdaccioPid}`);
144+
console.log('Done ✅');
145+
} catch {
146+
console.warn('Failed to kill Verdaccio process');
147+
}
141148
console.log('Cleanup: Removing Verdaccio storage directory');
142149
execSync(`rm -rf ${VERDACCIO_STORAGE_PATH}`);
143150
console.log('Done ✅');
144-
145-
// TODO(huntie): Fix memory leak from `spawn` in `setupVerdaccio` (above
146-
// kill command does not wait for kill success).
147-
process.exit(0);
148151
}
149152
}
150153

151-
async function runYarnUsingProxy(cwd /*: string */) {
154+
async function installProjectUsingProxy(cwd /*: string */) {
152155
const execOptions = {
153156
cwd,
154157
stdio: 'inherit',
155158
};
156-
execSync(
157-
`yarn config set npmRegistryServer "${VERDACCIO_SERVER_URL}"`,
158-
execOptions,
159-
);
160-
execSync(
161-
'yarn config set unsafeHttpWhitelist --json \'["localhost"]\'',
162-
execOptions,
163-
);
164159

165160
// TODO(huntie): Review pre-existing retry limit
166-
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+
]);
167166

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

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

Lines changed: 11 additions & 1 deletion
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');
@@ -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)