Skip to content

Commit

Permalink
Detect npm client in SummaryReporter (jestjs#3263)
Browse files Browse the repository at this point in the history
  • Loading branch information
thymikee authored and skovhus committed Apr 29, 2017
1 parent d2c7a55 commit 665c7de
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/jest-cli/src/reporters/SummaryReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,14 @@ class SummareReporter extends BaseReporter {
let updateCommand;
const event = process.env.npm_lifecycle_event;
const prefix = NPM_EVENTS.has(event) ? '' : 'run ';
const client = typeof process.env.npm_config_user_agent === 'string' &&
process.env.npm_config_user_agent.match('yarn') !== null
? 'yarn'
: 'npm';
if (config.watch) {
updateCommand = 'press `u`';
} else if (event) {
updateCommand = `run with \`npm ${prefix + event} -- -u\``;
updateCommand = `run with \`${client + ' ' + prefix + event} -- -u\``;
} else {
updateCommand = 're-run with `-u`';
}
Expand Down

0 comments on commit 665c7de

Please sign in to comment.