File tree 2 files changed +10
-5
lines changed
packages/jest-cli/src/reporters
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 11
11
([ #5353 ] ( https://github.com/facebook/jest/pull/5353 ) )
12
12
* ` [expect] ` Support class instances in ` .toHaveProperty() ` matcher.
13
13
([ #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 ) )
14
16
15
17
## jest 22.1.4
16
18
Original file line number Diff line number Diff line change @@ -129,19 +129,22 @@ export default class SummaryReporter extends BaseReporter {
129
129
let updateCommand ;
130
130
const event = process . env . npm_lifecycle_event ;
131
131
const prefix = NPM_EVENTS . has ( event ) ? '' : 'run ' ;
132
- const client =
132
+ const isYarn =
133
133
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' ;
137
136
const scriptUsesJest =
138
137
typeof process . env . npm_lifecycle_script === 'string' &&
139
138
process . env . npm_lifecycle_script . indexOf ( 'jest' ) !== - 1 ;
140
139
141
140
if ( globalConfig . watch ) {
142
141
updateCommand = 'press `u`' ;
143
142
} else if ( event && scriptUsesJest ) {
144
- updateCommand = `run \`${ client + ' ' + prefix + event } -u\`` ;
143
+ updateCommand = `run \`${ client +
144
+ ' ' +
145
+ prefix +
146
+ event +
147
+ ( isYarn ? '' : ' --' ) } -u\``;
145
148
} else {
146
149
updateCommand = 're-run jest with `-u`' ;
147
150
}
You can’t perform that action at this time.
0 commit comments