File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ Console.prototype.timeEnd = function(label) {
6868 const duration = process . hrtime ( time ) ;
6969 const ms = duration [ 0 ] * 1000 + duration [ 1 ] / 1e6 ;
7070 this . log ( '%s: %sms' , label , ms . toFixed ( 3 ) ) ;
71+ this . _times . delete ( label ) ;
7172} ;
7273
7374
Original file line number Diff line number Diff line change @@ -57,6 +57,16 @@ console.timeEnd('hasOwnProperty');
5757
5858global . process . stdout . write = stdout_write ;
5959
60+ // verify that console.timeEnd() doesn't leave dead links
61+ const timesMapSize = console . _times . size ;
62+ console . time ( 'label1' ) ;
63+ console . time ( 'label2' ) ;
64+ console . time ( 'label3' ) ;
65+ console . timeEnd ( 'label1' ) ;
66+ console . timeEnd ( 'label2' ) ;
67+ console . timeEnd ( 'label3' ) ;
68+ assert . strictEqual ( console . _times . size , timesMapSize ) ;
69+
6070assert . equal ( 'foo\n' , strings . shift ( ) ) ;
6171assert . equal ( 'foo bar\n' , strings . shift ( ) ) ;
6272assert . equal ( 'foo bar hop\n' , strings . shift ( ) ) ;
You can’t perform that action at this time.
0 commit comments