diff --git a/packages/jest-cli/src/reporters/SummaryReporter.js b/packages/jest-cli/src/reporters/SummaryReporter.js index d0e76407f3b0..2014bab55d9f 100644 --- a/packages/jest-cli/src/reporters/SummaryReporter.js +++ b/packages/jest-cli/src/reporters/SummaryReporter.js @@ -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`'; }