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 — lib: fix assert throwing different error messages in ESM and CJS by MrJithil · Pull Request #50634 · nodejs/node

Conversation

@MrJithil

@MrJithil MrJithil commented Nov 9, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This PR addresses issue #50593, which was caused by the design in the ESM loader.
The ESM loader was modifying the file path and replacing the 'file' property with the file proto in the stack trace.
This, in turn, led to unhandled exceptions when the assert module attempted to open the file to display erroneous code.

The changes in this PR resolve this issue by handling the file path correctly, ensuring that the remaining message formatting code can execute as expected.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bricss reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@nodejs-github-bot nodejs-github-bot added assert Issues and PRs related to the assert subsystem. needs-ci PRs that need a full CI run. labels Nov 9, 2023
@MrJithil
MrJithil force-pushed the fix-50593-assert--error-message-different-for-esm-and-cjs branch 2 times, most recently from 82348bd to dff486a Compare November 9, 2023 09:50
targos
targos reviewed Nov 9, 2023
View reviewed changes
Comment thread lib/assert.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@MrJithil
MrJithil force-pushed the fix-50593-assert--error-message-different-for-esm-and-cjs branch 2 times, most recently from 772e8a1 to 3414ac7 Compare November 9, 2023 13:15
@MrJithil
MrJithil requested a review from targos November 9, 2023 13:16
BridgeAR
BridgeAR reviewed Nov 9, 2023
View reviewed changes

@BridgeAR BridgeAR left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Code change LGTM. Please add a test case for it as well. That way it's possible to be approved :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

benjamingr and MrJithil reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
aduh95
aduh95 reviewed Nov 9, 2023
View reviewed changes
Comment thread lib/assert.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@MrJithil
MrJithil force-pushed the fix-50593-assert--error-message-different-for-esm-and-cjs branch from 3414ac7 to 0936e6f Compare November 10, 2023 00:52
@MrJithil
MrJithil requested review from BridgeAR and aduh95 November 10, 2023 00:52
@MrJithil
MrJithil force-pushed the fix-50593-assert--error-message-different-for-esm-and-cjs branch 3 times, most recently from d7d41e3 to 3cb46cf Compare November 10, 2023 10:09
@MrJithil

MrJithil commented Nov 10, 2023

Copy link
Copy Markdown
Member Author

Code change LGTM. Please add a test case for it as well. That way it's possible to be approved :)

Added test case.
@BridgeAR

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

aduh95
aduh95 reviewed Nov 10, 2023
View reviewed changes
Comment thread test/parallel/test-assert-esm-cjs-message-verify.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

aduh95
aduh95 reviewed Nov 10, 2023
View reviewed changes
Comment thread test/parallel/test-assert-esm-cjs-message-verify.js Resolved

Uh oh!

There was an error while loading. Please reload this page.

@MrJithil
lib: fix assert shows diff messages in ESM and CJS
22f1ad7
This PR addresses an issue which was caused by the design in
the ESM loader.
The ESM loader was modifying the file path and replacing the 'file'
property with the file proto in the stack trace.
This, in turn, led to unhandled exceptions when the assert module
attempted to open the file to display erroneous code.
The changes in this PR resolve this issue by handling the file path
correctly, ensuring that the remaining message formatting code can
execute as expected.
@MrJithil
MrJithil force-pushed the fix-50593-assert--error-message-different-for-esm-and-cjs branch from 3cb46cf to 22f1ad7 Compare November 11, 2023 05:07
@MrJithil
MrJithil requested a review from aduh95 November 11, 2023 06:03
aduh95
aduh95 approved these changes Nov 11, 2023
View reviewed changes
@aduh95 aduh95 added author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Nov 11, 2023
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 11, 2023
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
@nodejs-github-bot

nodejs-github-bot commented Nov 11, 2023 •
edited by jasnell
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/55558/ 💛

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes Nov 11, 2023
View reviewed changes
@jasnell jasnell added the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 11, 2023
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 11, 2023
@nodejs-github-bot
nodejs-github-bot merged commit 25fdb48 into nodejs:main Nov 11, 2023
@nodejs-github-bot

nodejs-github-bot commented Nov 11, 2023

Copy link
Copy Markdown
Collaborator

Landed in 25fdb48

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

targos pushed a commit that referenced this pull request Nov 11, 2023
@MrJithil @targos
lib: fix assert shows diff messages in ESM and CJS
592b18f
This PR addresses an issue which was caused by the design in
the ESM loader.
The ESM loader was modifying the file path and replacing the 'file'
property with the file proto in the stack trace.
This, in turn, led to unhandled exceptions when the assert module
attempted to open the file to display erroneous code.
The changes in this PR resolve this issue by handling the file path
correctly, ensuring that the remaining message formatting code can
execute as expected.

PR-URL: #50634
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@github-actions github-actions Bot mentioned this pull request Nov 12, 2023
CI Reliability 2023-11-12 nodejs/reliability#715
Open
18 tasks
@targos targos mentioned this pull request Nov 12, 2023
v21.2.0 release proposal #50681
Merged
This was referenced Nov 13, 2023
CI Reliability 2023-11-13 nodejs/reliability#716
Open
CI Reliability 2023-11-14 nodejs/reliability#717
Open
targos pushed a commit that referenced this pull request Nov 14, 2023
@MrJithil @targos
lib: fix assert shows diff messages in ESM and CJS
363bc46
This PR addresses an issue which was caused by the design in
the ESM loader.
The ESM loader was modifying the file path and replacing the 'file'
property with the file proto in the stack trace.
This, in turn, led to unhandled exceptions when the assert module
attempted to open the file to display erroneous code.
The changes in this PR resolve this issue by handling the file path
correctly, ensuring that the remaining message formatting code can
execute as expected.

PR-URL: #50634
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
UlisesGascon pushed a commit that referenced this pull request Dec 11, 2023
@MrJithil @UlisesGascon
lib: fix assert shows diff messages in ESM and CJS
f1cf1c3
This PR addresses an issue which was caused by the design in
the ESM loader.
The ESM loader was modifying the file path and replacing the 'file'
property with the file proto in the stack trace.
This, in turn, led to unhandled exceptions when the assert module
attempted to open the file to display erroneous code.
The changes in this PR resolve this issue by handling the file path
correctly, ensuring that the remaining message formatting code can
execute as expected.

PR-URL: #50634
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@UlisesGascon UlisesGascon mentioned this pull request Dec 12, 2023
v20.11.0 proposal #51124
Merged
codebytere added a commit to electron/electron that referenced this pull request Jan 10, 2024
@codebytere
lib: fix assert throwing different error messages in ESM and CJS
da59e4c
nodejs/node#50634
zcbenz pushed a commit to electron/electron that referenced this pull request Jan 12, 2024
@codebytere @zcbenz
lib: fix assert throwing different error messages in ESM and CJS
eb03edd
nodejs/node#50634
zcbenz pushed a commit to electron/electron that referenced this pull request Jan 12, 2024
@codebytere @zcbenz
lib: fix assert throwing different error messages in ESM and CJS
3c42832
nodejs/node#50634
codebytere added a commit to electron/electron that referenced this pull request Jan 15, 2024
@codebytere
lib: fix assert throwing different error messages in ESM and CJS
2fe5368
nodejs/node#50634
codebytere added a commit to electron/electron that referenced this pull request Jan 15, 2024
@codebytere
lib: fix assert throwing different error messages in ESM and CJS
4b9926b
nodejs/node#50634
codebytere added a commit to electron/electron that referenced this pull request Jan 16, 2024
@codebytere
lib: fix assert throwing different error messages in ESM and CJS
41a1820
nodejs/node#50634
codebytere added a commit to electron/electron that referenced this pull request Jan 18, 2024
@codebytere
lib: fix assert throwing different error messages in ESM and CJS
fd6913f
nodejs/node#50634
jkleinsc pushed a commit to electron/electron that referenced this pull request Jan 18, 2024
@codebytere @jkleinsc
lib: fix assert throwing different error messages in ESM and CJS
7f5f709
nodejs/node#50634
codebytere added a commit to electron/electron that referenced this pull request Jan 18, 2024
@codebytere
lib: fix assert throwing different error messages in ESM and CJS
e87b61b
nodejs/node#50634
jkleinsc pushed a commit to electron/electron that referenced this pull request Jan 18, 2024
@electron-roller @codebytere @zcbenz
chore: bump node to v20.11.0 (main) (#40941)
f4ee3c1
* chore: bump node in DEPS to v20.11.0

* module: bootstrap module loaders in shadow realm

nodejs/node#48655

* src: add commit hash shorthand in zlib version

nodejs/node#50158

* v8,tools: expose necessary V8 defines

nodejs/node#50820

* esm: do not call getSource when format is commonjs

nodejs/node#50465

* esm: fallback to readFileSync when source is nullish

nodejs/node#50825

* vm: allow dynamic import with a referrer realm

nodejs/node#50360

* test: skip test-diagnostics-channel-memory-leak.js

nodejs/node#50327

* esm: do not call getSource when format is commonjs

nodejs/node#50465

* lib: fix assert throwing different error messages in ESM and CJS

nodejs/node#50634

* src: fix compatility with upcoming V8 12.1 APIs

nodejs/node#50709

* deps: update base64 to 0.5.1

nodejs/node#50629

* src: avoid silent coercion to signed/unsigned int

nodejs/node#50663

* src: fix compatility with upcoming V8 12.1 APIs

nodejs/node#50709

* chore: fix patch indices

* chore: update patches

* test: disable TLS cipher test

This can't be enabled owing to BoringSSL incompatibilities.

nodejs/node#50186

* fix: check for Buffer and global definition in shadow realm

nodejs/node#51239

* test: disable parallel/test-shadow-realm-custom-loader

Incompatible with our asar logic, resulting in the following failure:

> Failed to CompileAndCall electron script: electron/js2c/asar_bundle

* chore: remove deleted parallel/test-crypto-modp1-error test

* test: make test-node-output-v8-warning generic

nodejs/node#50421

* chore: fixup ModuleWrap patch

* test: match wpt/streams/transferable/transform-stream-members.any.js to upstream

* fix: sandbox is not enabled on arm

* chore: disable v8 sandbox on ia32/arm

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <[email protected]>
Co-authored-by: Cheng Zhao <[email protected]>
@ibrahimkhled ibrahimkhled mentioned this pull request Jul 25, 2024
CI: https://ci.nodejs.org/job/node-test-pull-request/55558/ 💛 Tenderly/tenderly-cli#187
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@aduh95 aduh95 aduh95 approved these changes
@targos targos Awaiting requested review from targos
@BridgeAR BridgeAR Awaiting requested review from BridgeAR

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

assert Issues and PRs related to the assert subsystem. author ready PRs with CI started, the required approvals, and no outstanding review comments. needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@MrJithil @nodejs-github-bot @jasnell @targos @BridgeAR @aduh95
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.