From e993a1703820f0e8e768e6732b9ead69c1d3b646 Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya Date: Fri, 30 Jun 2017 08:15:35 +0100 Subject: [PATCH] Fix: fix e2e yarn output tests after #3536 **Summary** Fixes #3536. Explicitly and programmatically passes `YARN_SILENT=0` to test runs that checks yarn's output. **Test plan** All CI tests and local test runs with yarn 0.27.3 should pass. --- __tests__/index.js | 36 ++++++++++++++++++++++------------ __tests__/lifecycle-scripts.js | 24 ++++++++++++++++------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/__tests__/index.js b/__tests__/index.js index 23e324124b..f30edee001 100644 --- a/__tests__/index.js +++ b/__tests__/index.js @@ -30,19 +30,29 @@ async function execCommand( } return new Promise((resolve, reject) => { - exec(`node "${yarnBin}" ${cmd} ${args.join(' ')}`, {cwd: workingDir, env: process.env}, (error, stdout) => { - if (error) { - reject({error, stdout}); - } else { - const stdoutLines = stdout - .toString() - .split('\n') - .map((line: ?string) => line && line.trim()) - .filter((line: ?string) => line); - - resolve(stdoutLines); - } - }); + exec( + `node "${yarnBin}" ${cmd} ${args.join(' ')}`, + { + cwd: workingDir, + env: { + ...process.env, + YARN_SILENT: 0, + }, + }, + (error, stdout) => { + if (error) { + reject({error, stdout}); + } else { + const stdoutLines = stdout + .toString() + .split('\n') + .map((line: ?string) => line && line.trim()) + .filter((line: ?string) => line); + + resolve(stdoutLines); + } + }, + ); }); } diff --git a/__tests__/lifecycle-scripts.js b/__tests__/lifecycle-scripts.js index 06b7b835dc..d0a0255eda 100644 --- a/__tests__/lifecycle-scripts.js +++ b/__tests__/lifecycle-scripts.js @@ -19,13 +19,23 @@ async function execCommand(cmd: string, packageName: string, env = process.env): await fs.copy(srcPackageDir, packageDir, new NoopReporter()); return new Promise((resolve, reject) => { - exec(`node "${yarnBin}" ${cmd}`, {cwd: packageDir, env}, (err, stdout) => { - if (err) { - reject(err); - } else { - resolve(stdout.toString()); - } - }); + exec( + `node "${yarnBin}" ${cmd}`, + { + cwd: packageDir, + env: { + ...env, + YARN_SILENT: 0, + }, + }, + (err, stdout) => { + if (err) { + reject(err); + } else { + resolve(stdout.toString()); + } + }, + ); }); }