Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if npm_lifecycle_script calls jest directly #4629

Merged
merged 2 commits into from
Oct 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/jest-cli/src/reporters/summary_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,16 @@ export default class SummaryReporter extends BaseReporter {
process.env.npm_config_user_agent.match('yarn') !== null
? 'yarn'
: 'npm';
const scriptUsesJest =
typeof process.env.npm_lifecycle_script === 'string' &&
process.env.npm_lifecycle_script.indexOf('jest') !== -1;

if (globalConfig.watch) {
updateCommand = 'press `u`';
} else if (event) {
updateCommand = `run with \`${client + ' ' + prefix + event} -- -u\``;
} else if (event && scriptUsesJest) {
updateCommand = `run \`${client + ' ' + prefix + event} -u\``;
} else {
updateCommand = 're-run with `-u`';
updateCommand = 're-run jest with `-u`';
}

const snapshotSummary = getSnapshotSummary(snapshots, updateCommand);
Expand Down