Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert: callTracker throw a specific error message when possible #43640

Merged
merged 3 commits into from
Jul 8, 2022

Conversation

MoLow
Copy link
Member

@MoLow MoLow commented Jul 1, 2022

currently callTracker.verify() throws a very generic error message when a tracked function isn't called the expected amount of times.

this change propeses to throw a more specific message in case there was a single-tracked function that did not match the expected call counts

@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 Jul 1, 2022
@MoLow MoLow force-pushed the assert-specific-error-message branch from 3d6fcbb to 0b3b3cd Compare July 3, 2022 07:02
@benjamingr
Copy link
Member

benjamingr commented Jul 3, 2022

@nodejs/test_runner @nodejs/assert

lib/internal/assert/calltracker.js Outdated Show resolved Hide resolved
lib/internal/assert/calltracker.js Outdated Show resolved Hide resolved
test/parallel/test-assert-calltracker-verify.js Outdated Show resolved Hide resolved
@MoLow MoLow force-pushed the assert-specific-error-message branch from 0b3b3cd to 2449674 Compare July 4, 2022 21:11
@MoLow MoLow requested a review from aduh95 July 4, 2022 21:11
@MoLow MoLow force-pushed the assert-specific-error-message branch from 2449674 to f878298 Compare July 5, 2022 08:59
@MoLow MoLow requested a review from aduh95 July 5, 2022 08:59
@aduh95
Copy link
Contributor

aduh95 commented Jul 5, 2022

@MoLow FYI force-pushing to your branch makes reviewing harder as GitHub UI can't show the diff since last review, so reviewers basically have to re-review the whole PR. Not a very big deal, but I wanted to let you know in case you didn't know – and of course sometimes force-pushes are necessary, e.g. when there's a git conflict to fix.

@MoLow
Copy link
Member Author

MoLow commented Jul 5, 2022

@MoLow FYI force-pushing to your branch makes reviewing harder as GitHub UI can't show the diff since last review, so reviewers basically have to re-review the whole PR. Not a very big deal, but I wanted to let you know in case you didn't know – and of course sometimes force-pushes are necessary, e.g. when there's a git conflict to fix.

I do see the downside, however, I try to keep up to date with main since more than once that was the only way to get fixes to tests failing the CI.
Il try ro avoid this and perform less often, thanks for the feedback!

@aduh95 aduh95 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 6, 2022
@Linkgoron Linkgoron added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 7, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 7, 2022
@richardlau richardlau added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 7, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 7, 2022
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@benjamingr benjamingr added the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 8, 2022
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jul 8, 2022
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/43640
✔  Done loading data for nodejs/node/pull/43640
----------------------------------- PR info ------------------------------------
Title      assert: callTracker throw a specific error message when possible (#43640)
Author     Moshe Atlow  (@MoLow)
Branch     MoLow:assert-specific-error-message -> nodejs:main
Labels     assert, author ready, needs-ci
Commits    3
 - assert: callTracker throw a specific error message when possible
 - CR
 - CR
Committers 1
 - Moshe Atlow 
PR-URL: https://github.com/nodejs/node/pull/43640
Reviewed-By: Antoine du Hamel 
Reviewed-By: Nitzan Uziely 
Reviewed-By: Benjamin Gruenbaum 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/43640
Reviewed-By: Antoine du Hamel 
Reviewed-By: Nitzan Uziely 
Reviewed-By: Benjamin Gruenbaum 
--------------------------------------------------------------------------------
   ℹ  This PR was created on Fri, 01 Jul 2022 07:39:43 GMT
   ✔  Approvals: 3
   ✔  - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/43640#pullrequestreview-1028301103
   ✔  - Nitzan Uziely (@linkgoron): https://github.com/nodejs/node/pull/43640#pullrequestreview-1031952209
   ✔  - Benjamin Gruenbaum (@benjamingr): https://github.com/nodejs/node/pull/43640#pullrequestreview-1032124384
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2022-07-08T07:51:08Z: https://ci.nodejs.org/job/node-test-pull-request/45149/
- Querying data for job/node-test-pull-request/45149/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 43640
From https://github.com/nodejs/node
 * branch                  refs/pull/43640/merge -> FETCH_HEAD
✔  Fetched commits as f3a92a0572b1..f87829815671
--------------------------------------------------------------------------------
[main 056d3eda99] assert: callTracker throw a specific error message when possible
 Author: Moshe Atlow 
 Date: Fri Jul 1 10:32:10 2022 +0300
 2 files changed, 32 insertions(+), 12 deletions(-)
[main a84f04a6a7] CR
 Author: Moshe Atlow 
 Date: Tue Jul 5 00:11:23 2022 +0300
 2 files changed, 5 insertions(+), 6 deletions(-)
[main 7baf7e12e7] CR
 Author: Moshe Atlow 
 Date: Tue Jul 5 11:58:52 2022 +0300
 1 file changed, 8 insertions(+), 2 deletions(-)
   ✔  Patches applied
There are 3 commits in the PR. Attempting autorebase.
Rebasing (2/6)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
assert: callTracker throw a specific error message when possible

PR-URL: #43640
Reviewed-By: Antoine du Hamel duhamelantoine1995@gmail.com
Reviewed-By: Nitzan Uziely linkgoron@gmail.com
Reviewed-By: Benjamin Gruenbaum benjamingr@gmail.com

[detached HEAD 9df1c4dbde] assert: callTracker throw a specific error message when possible
Author: Moshe Atlow moshe@atlow.co.il
Date: Fri Jul 1 10:32:10 2022 +0300
2 files changed, 32 insertions(+), 12 deletions(-)
Rebasing (3/6)
Rebasing (4/6)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
CR

PR-URL: #43640
Reviewed-By: Antoine du Hamel duhamelantoine1995@gmail.com
Reviewed-By: Nitzan Uziely linkgoron@gmail.com
Reviewed-By: Benjamin Gruenbaum benjamingr@gmail.com

[detached HEAD 63c397ec6a] CR
Author: Moshe Atlow moshe@atlow.co.il
Date: Tue Jul 5 00:11:23 2022 +0300
2 files changed, 5 insertions(+), 6 deletions(-)
Rebasing (5/6)
Rebasing (6/6)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
CR

PR-URL: #43640
Reviewed-By: Antoine du Hamel duhamelantoine1995@gmail.com
Reviewed-By: Nitzan Uziely linkgoron@gmail.com
Reviewed-By: Benjamin Gruenbaum benjamingr@gmail.com

[detached HEAD 28c8d90652] CR
Author: Moshe Atlow moshe@atlow.co.il
Date: Tue Jul 5 11:58:52 2022 +0300
1 file changed, 8 insertions(+), 2 deletions(-)

Successfully rebased and updated refs/heads/main.

ℹ Use --fixupAll option, squash the PR manually or land the PR from the command line.

https://github.com/nodejs/node/actions/runs/2635335874

@benjamingr benjamingr added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jul 8, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jul 8, 2022
@nodejs-github-bot nodejs-github-bot merged commit 458c4fb into nodejs:main Jul 8, 2022
@nodejs-github-bot
Copy link
Collaborator

Landed in 458c4fb

@MoLow MoLow deleted the assert-specific-error-message branch July 8, 2022 10:18
targos pushed a commit that referenced this pull request Jul 12, 2022
PR-URL: #43640
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit that referenced this pull request Jul 20, 2022
PR-URL: #43640
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit that referenced this pull request Jul 31, 2022
PR-URL: #43640
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
PR-URL: nodejs/node#43640
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assert Issues and PRs related to the assert subsystem. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants