File tree Expand file tree Collapse file tree
packages/jest-cli/src/reporters Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111 ([ #5353 ] ( https://github.com/facebook/jest/pull/5353 ) )
1212* ` [expect] ` Support class instances in ` .toHaveProperty() ` matcher.
1313 ([ #5367 ] ( https://github.com/facebook/jest/pull/5367 ) )
14+ * ` [jest-cli] ` Fix npm update command for snapshot summary.
15+ ([ #5376 ] ( https://github.com/facebook/jest/pull/5376 ) )
1416
1517## jest 22.1.4
1618
Original file line number Diff line number Diff line change @@ -129,19 +129,22 @@ export default class SummaryReporter extends BaseReporter {
129129 let updateCommand ;
130130 const event = process . env . npm_lifecycle_event ;
131131 const prefix = NPM_EVENTS . has ( event ) ? '' : 'run ' ;
132- const client =
132+ const isYarn =
133133 typeof process . env . npm_config_user_agent === 'string' &&
134- process . env . npm_config_user_agent . match ( 'yarn' ) !== null
135- ? 'yarn'
136- : 'npm' ;
134+ process . env . npm_config_user_agent . match ( 'yarn' ) !== null ;
135+ const client = isYarn ? 'yarn' : 'npm' ;
137136 const scriptUsesJest =
138137 typeof process . env . npm_lifecycle_script === 'string' &&
139138 process . env . npm_lifecycle_script . indexOf ( 'jest' ) !== - 1 ;
140139
141140 if ( globalConfig . watch ) {
142141 updateCommand = 'press `u`' ;
143142 } else if ( event && scriptUsesJest ) {
144- updateCommand = `run \`${ client + ' ' + prefix + event } -u\`` ;
143+ updateCommand = `run \`${ client +
144+ ' ' +
145+ prefix +
146+ event +
147+ ( isYarn ? '' : ' --' ) } -u\``;
145148 } else {
146149 updateCommand = 're-run jest with `-u`' ;
147150 }
You can’t perform that action at this time.
0 commit comments