Skip to content

fix(node:console): ensure that the node:console implementation has an implementation for emitWarning in scope#31263

Merged
bartlomieju merged 3 commits intodenoland:mainfrom
JakeChampion:jake/console
Nov 13, 2025
Merged

fix(node:console): ensure that the node:console implementation has an implementation for emitWarning in scope#31263
bartlomieju merged 3 commits intodenoland:mainfrom
JakeChampion:jake/console

Conversation

@JakeChampion
Copy link
Copy Markdown
Contributor

Introduces the emitWarning function from the process module to enable warning capabilities within the console constructor implementation.

This fixes a bug where the time, countReset and timeLogImpl functions would throw an error due to trying to call emitWarning, they would throw an error for an undefined variable named emitWarning or if a global function had that name` they would call that function, which is not expected behaviour here.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug where the node:console implementation's time(), countReset(), and timeLogImpl() functions would fail when calling emitWarning due to it being undefined. The fix imports emitWarning from node:process at the module level, and adds a test to verify these functions work correctly.

  • Imports emitWarning from node:process into the console constructor module
  • Adds a test that instantiates a Console and calls the previously broken methods

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
ext/node/polyfills/internal/console/constructor.mjs Adds import statement for emitWarning from node:process to make it available in scope
tests/unit_node/console_test.ts Adds test case that calls console methods which trigger emitWarning calls

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/unit_node/console_test.ts
Comment thread tests/unit_node/console_test.ts
@JakeChampion JakeChampion force-pushed the jake/console branch 7 times, most recently from d06d01c to 054d0cc Compare November 12, 2025 16:56
…n for `emitWarning` in scope

Introduces the emitWarning function from the process module to enable warning capabilities within the console constructor implementation.

This fixes a bug where the `time`, `countReset` and `timeLogImpl` functions would throw an error due to trying to call `emitWarning`, they would throw an error for an undefined variable named `emitWarning` or if a global function had that name` they would call that function, which is not expected behaviour here.
Signed-off-by: Jake Champion <me@jakechampion.name>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bartlomieju bartlomieju merged commit 05bc636 into denoland:main Nov 13, 2025
25 checks passed
bartlomieju pushed a commit that referenced this pull request Nov 14, 2025
… implementation for `emitWarning` in scope (#31263)

Introduces the emitWarning function from the process module to enable
warning capabilities within the console constructor implementation.

This fixes a bug where the `time`, `countReset` and `timeLogImpl`
functions would throw an error due to trying to call `emitWarning`, they
would throw an error for an undefined variable named `emitWarning` or if
a global function had that name` they would call that function, which is
not expected behaviour here.

---------

Signed-off-by: Jake Champion <me@jakechampion.name>
bartlomieju pushed a commit to bartlomieju/deno that referenced this pull request Nov 17, 2025
… implementation for `emitWarning` in scope (denoland#31263)

Introduces the emitWarning function from the process module to enable
warning capabilities within the console constructor implementation.

This fixes a bug where the `time`, `countReset` and `timeLogImpl`
functions would throw an error due to trying to call `emitWarning`, they
would throw an error for an undefined variable named `emitWarning` or if
a global function had that name` they would call that function, which is
not expected behaviour here.

---------

Signed-off-by: Jake Champion <me@jakechampion.name>
bartlomieju pushed a commit that referenced this pull request Jan 22, 2026
… implementation for `emitWarning` in scope (#31263)

Introduces the emitWarning function from the process module to enable
warning capabilities within the console constructor implementation.

This fixes a bug where the `time`, `countReset` and `timeLogImpl`
functions would throw an error due to trying to call `emitWarning`, they
would throw an error for an undefined variable named `emitWarning` or if
a global function had that name` they would call that function, which is
not expected behaviour here.

---------

Signed-off-by: Jake Champion <me@jakechampion.name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants