mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Switch e2e to yarn
Summary: Addresses CI build failures due to use of scoped packages by metro. Closes https://github.com/facebook/react-native/pull/17878 Differential Revision: D6914937 Pulled By: hramos fbshipit-source-id: e6ce97561035f4deb128cd1e30d81ab4edea3e4c
This commit is contained in:
committed by
Facebook Github Bot
parent
613afbab7f
commit
fa11faecb6
@@ -17,7 +17,7 @@
|
||||
* --android - 'react-native init' and check Android app doesn't redbox
|
||||
* --js - 'react-native init' and only check the packager returns a bundle
|
||||
* --skip-cli-install - to skip react-native-cli global installation (for local debugging)
|
||||
* --retries [num] - how many times to retry possible flaky commands: npm install and running tests, default 1
|
||||
* --retries [num] - how many times to retry possible flaky commands: yarn add and running tests, default 1
|
||||
*/
|
||||
/*eslint-disable no-undef */
|
||||
require('shelljs/global');
|
||||
@@ -44,12 +44,12 @@ let exitCode;
|
||||
try {
|
||||
// install CLI
|
||||
cd('react-native-cli');
|
||||
exec('npm pack');
|
||||
exec('yarn pack');
|
||||
const CLI_PACKAGE = path.join(ROOT, 'react-native-cli', 'react-native-cli-*.tgz');
|
||||
cd('..');
|
||||
|
||||
if (!argv['skip-cli-install']) {
|
||||
if (exec(`sudo npm install -g ${CLI_PACKAGE}`).code) {
|
||||
if (exec(`sudo yarn global add ${CLI_PACKAGE}`).code) {
|
||||
echo('Could not install react-native-cli globally.');
|
||||
echo('Run with --skip-cli-install to skip this step');
|
||||
exitCode = 1;
|
||||
@@ -65,7 +65,7 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
if (exec('npm pack').code) {
|
||||
if (exec('yarn pack').code) {
|
||||
echo('Failed to pack react-native');
|
||||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
@@ -76,7 +76,7 @@ try {
|
||||
if (tryExecNTimes(
|
||||
() => {
|
||||
exec('sleep 10s');
|
||||
return exec(`react-native init EndToEndTest --version ${PACKAGE} --npm`).code;
|
||||
return exec(`react-native init EndToEndTest --version ${PACKAGE}`).code;
|
||||
},
|
||||
numberOfRetries,
|
||||
() => rm('-rf', 'EndToEndTest'))) {
|
||||
@@ -92,7 +92,7 @@ try {
|
||||
echo('Running an Android e2e test');
|
||||
echo('Installing e2e framework');
|
||||
if (tryExecNTimes(
|
||||
() => exec('npm install --save-dev appium@1.5.1 mocha@2.4.5 wd@0.3.11 colors@1.0.3 pretty-data2@0.40.1', { silent: true }).code,
|
||||
() => exec('yarn add --dev appium@1.5.1 mocha@2.4.5 wd@0.3.11 colors@1.0.3 pretty-data2@0.40.1', { silent: true }).code,
|
||||
numberOfRetries)) {
|
||||
echo('Failed to install appium');
|
||||
echo('Most common reason is npm registry connectivity, try again');
|
||||
@@ -125,7 +125,7 @@ try {
|
||||
|
||||
echo(`Starting packager server, ${SERVER_PID}`);
|
||||
// shelljs exec('', {async: true}) does not emit stdout events, so we rely on good old spawn
|
||||
const packagerProcess = spawn('npm', ['start', '--', '--max-workers 1'], {
|
||||
const packagerProcess = spawn('yarn', ['start', '--max-workers 1'], {
|
||||
env: process.env
|
||||
});
|
||||
SERVER_PID = packagerProcess.pid;
|
||||
@@ -158,7 +158,7 @@ try {
|
||||
// shelljs exec('', {async: true}) does not emit stdout events, so we rely on good old spawn
|
||||
const packagerEnv = Object.create(process.env);
|
||||
packagerEnv.REACT_NATIVE_MAX_WORKERS = 1;
|
||||
const packagerProcess = spawn('npm', ['start', '--', '--nonPersistent'],
|
||||
const packagerProcess = spawn('yarn', ['start', '--nonPersistent'],
|
||||
{
|
||||
stdio: 'inherit',
|
||||
env: packagerEnv
|
||||
@@ -204,7 +204,7 @@ try {
|
||||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
}
|
||||
if (exec('npm test').code) {
|
||||
if (exec('yarn test').code) {
|
||||
echo('Jest test failure');
|
||||
exitCode = 1;
|
||||
throw Error(exitCode);
|
||||
|
||||
Reference in New Issue
Block a user