FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test: fix `common.mustNotCall` error message by aduh95 · Pull Request #42917 · nodejs/node · GitHub

/ node Public

test: fix common.mustNotCall error message - #42917

Merged
aduh95 merged 1 commit into
nodejs:masterfrom
aduh95:fix-mustNotCall-error
Jun 12, 2022
Merged

test: fix common.mustNotCall error message#42917
aduh95 merged 1 commit into
nodejs:masterfrom
aduh95:fix-mustNotCall-error

Conversation

aduh95 commented Apr 29, 2022

Copy link
Copy Markdown
Contributor

When using util.inspect as a callback, the array index (second
argument) is picked up as the showHidden param, and the argument
array (third argument) as the depth param. This fails with a seemingly
unrelated error message when the argument array contains a
Symbol-related property.

Before this change, the following error was output:

node:internal/util/inspect:1014
  if (recurseTimes > ctx.depth && ctx.depth !== null) {
                   ^

TypeError: Cannot convert a Symbol value to a string
    at Array.join (<anonymous>)
    at Array.toString (<anonymous>)
    at formatRaw (node:internal/util/inspect:1014:20)
    at formatValue (node:internal/util/inspect:817:10)
    at inspect (node:internal/util/inspect:347:10)
    at Array.map (<anonymous>)
    at Object.mustNotCall [as get] (…)
    at Array.join (<anonymous>)
    at Array.toString (<anonymous>)
    at formatRaw (node:internal/util/inspect:1014:20)

Node.js v19.0.0-pre

With this change:

node:assert:170
  throw err;
  ^

AssertionError [ERR_ASSERTION]: function should not have been called at …
called with arguments: [Function: func] { customProperty: Symbol() }, 'customProperty', [Function: func] { customProperty: Symbol() }
    at Object.mustNotCall [as get] (…/test/common/index.js:516:12)
    at Object.<anonymous> (…)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: [Getter],
  expected: [Getter],
  operator: 'fail'
}

Node.js v19.0.0-pre

nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Apr 29, 2022

aduh95 commented May 10, 2022

Copy link
Copy Markdown
Contributor Author

/cc @nodejs/testing

ljharb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM regardless of comment

Comment thread test/common/index.js Outdated
aduh95 added the review wanted PRs that need reviews. label Jun 2, 2022

aduh95 commented Jun 2, 2022

Copy link
Copy Markdown
Contributor Author

Ping @nodejs/testing for reviews.

aduh95 added author ready PRs that have at least one approval, no outstanding review comments, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jun 2, 2022
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 2, 2022

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

When using `util.inspect` as a callback, the array index (second
argument) is picked up as the `showHidden` param, and the argument
array (third argument) as the `depth` param. This fails with a seemingly
unrelated error message when the argument array contains a
`Symbol`-related property.

PR-URL: nodejs#42917
Reviewed-By: Michaël Zasso <targos@protonmail.com>
aduh95 force-pushed the fix-mustNotCall-error branch from ae2516c to 5114c46 Compare June 12, 2022 09:40
aduh95 merged commit 5114c46 into nodejs:master Jun 12, 2022

aduh95 commented Jun 12, 2022

Copy link
Copy Markdown
Contributor Author

Landed in 5114c46

aduh95 deleted the fix-mustNotCall-error branch June 12, 2022 09:41
danielleadams mentioned this pull request Jun 13, 2022
danielleadams pushed a commit that referenced this pull request Jun 13, 2022
When using `util.inspect` as a callback, the array index (second
argument) is picked up as the `showHidden` param, and the argument
array (third argument) as the `depth` param. This fails with a seemingly
unrelated error message when the argument array contains a
`Symbol`-related property.

PR-URL: #42917
Reviewed-By: Michaël Zasso <targos@protonmail.com>
targos pushed a commit that referenced this pull request Jul 12, 2022
When using `util.inspect` as a callback, the array index (second
argument) is picked up as the `showHidden` param, and the argument
array (third argument) as the `depth` param. This fails with a seemingly
unrelated error message when the argument array contains a
`Symbol`-related property.

PR-URL: #42917
Reviewed-By: Michaël Zasso <targos@protonmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2022
When using `util.inspect` as a callback, the array index (second
argument) is picked up as the `showHidden` param, and the argument
array (third argument) as the `depth` param. This fails with a seemingly
unrelated error message when the argument array contains a
`Symbol`-related property.

PR-URL: #42917
Reviewed-By: Michaël Zasso <targos@protonmail.com>
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
When using `util.inspect` as a callback, the array index (second
argument) is picked up as the `showHidden` param, and the argument
array (third argument) as the `depth` param. This fails with a seemingly
unrelated error message when the argument array contains a
`Symbol`-related property.

PR-URL: nodejs/node#42917
Reviewed-By: Michaël Zasso <targos@protonmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. needs-ci PRs that need a full CI run. review wanted PRs that need reviews. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL