Skip to content

Commit

Permalink
Fix: fix e2e yarn output tests after #3536
Browse files Browse the repository at this point in the history
**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.
  • Loading branch information
Burak Yigit Kaya committed Jun 30, 2017
1 parent f536494 commit e993a17
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 20 deletions.
36 changes: 23 additions & 13 deletions __tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
},
);
});
}

Expand Down
24 changes: 17 additions & 7 deletions __tests__/lifecycle-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
},
);
});
}

Expand Down

0 comments on commit e993a17

Please sign in to comment.