GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — console: delete timers that have ended · nodejs/node@a5cce79

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • console.js
  • test/parallel
    • test-console.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/console.js‎

Copy file name to clipboardExpand all lines: lib/console.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

Collapse file

‎test/parallel/test-console.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-console.js
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ console.timeEnd('hasOwnProperty');
5757

5858
global.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+
6070
assert.equal('foo\n', strings.shift());
6171
assert.equal('foo bar\n', strings.shift());
6272
assert.equal('foo bar hop\n', strings.shift());

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.