File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,10 @@ class UpdateNotifier {
9494 this . update = this . config . get ( 'update' ) ;
9595
9696 if ( this . update ) {
97+ // Use the real latest version instead of the cached one
98+ this . update . current = this . packageVersion ;
99+
100+ // Clear cached information
97101 this . config . delete ( 'update' ) ;
98102 }
99103
@@ -123,7 +127,7 @@ class UpdateNotifier {
123127
124128 notify ( options ) {
125129 const suppressForNpm = ! this . shouldNotifyInNpmScript && isNpm ( ) . isNpmOrYarn ;
126- if ( ! process . stdout . isTTY || suppressForNpm || ! this . update ) {
130+ if ( ! process . stdout . isTTY || suppressForNpm || ! this . update || this . update . current === this . update . latest ) {
127131 return this ;
128132 }
129133
Original file line number Diff line number Diff line change @@ -83,3 +83,11 @@ test('should ouput if running as npm script and shouldNotifyInNpmScript option s
8383 notifier . notify ( { defer : false } ) ;
8484 t . true ( stripAnsi ( errorLogs ) . includes ( 'Update available' ) ) ;
8585} ) ;
86+
87+ test ( 'should not output if current version is the latest' , t => {
88+ setupTest ( true ) ;
89+ const notifier = new Control ( true ) ;
90+ notifier . update . current = '1.0.0' ;
91+ notifier . notify ( { defer : false } ) ;
92+ t . false ( stripAnsi ( errorLogs ) . includes ( 'Update available' ) ) ;
93+ } ) ;
You can’t perform that action at this time.
0 commit comments