Skip to content

test: improve async hooks test error messages - #13243

Closed
addaleax wants to merge 1 commit into
nodejs:masterfrom
addaleax:async-hooks-test-message
Closed

test: improve async hooks test error messages#13243
addaleax wants to merge 1 commit into
nodejs:masterfrom
addaleax:async-hooks-test-message

Conversation

@addaleax

Copy link
Copy Markdown
Member

Improve error messages in the async hooks tests, mostly by removing
unhelpful message parameters for assertions.

(@Trott, maybe we could have a lint rule that forbids literals as messages if this PR is somewhat well-received?)

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test/async_hooks

@addaleaxaddaleax added async_hooks Issues and PRs related to the async hooks subsystem. dont-land-on-v4.x test Issues and PRs related to the tests. labels May 26, 2017
@nodejs-github-botnodejs-github-bot added async_hooks Issues and PRs related to the async hooks subsystem. test Issues and PRs related to the tests. labels May 26, 2017

@AndreasMadsenAndreasMadsen 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.

@refack

Copy link
Copy Markdown
Contributor

From a partial scan I agree with 97% of removals.
Some might have value... like: assert.strictEqual(code, 1, 'exit code 1');
Would you wait a day or two before landing, I really want to review them all (It will be a shame to lose good information if it's in there)

@refack

refack commented May 29, 2017

Copy link
Copy Markdown
Contributor

(@Trott, maybe we could have a lint rule that forbids literals as messages if this PR is somewhat well-received?)

Sounds good, but maybe a little bit more lax, like if it's more than n characters long, or has at least 4 white space groups (meaning 5 words), or has some keywords like should, it might be good as well.
[edit] meanwhile it should be communicated to Collaborators not to approve these sort of unhelpful messages, as they actually hide the default which is better.

@addaleax

addaleax commented May 29, 2017

Copy link
Copy Markdown
MemberAuthor

Some might have value... like: assert.strictEqual(code, 1, 'exit code 1');

I wouldn’t agree. exit code 1 is an unhelpful error message, because it just states the expected result; but that I can easily look up by looking at where the stack trace points. Providing the actual exit code is a lot more helpful.

Would you wait a day or two before landing, I really want to review them all (It will be a shame to lose good information if it's in there)

Sure, this isn’t urgent.

@jasnell

Copy link
Copy Markdown
Member

ping @refack ... have you had a chance to review yet?

@refack

Copy link
Copy Markdown
Contributor

halfway there.

@trevnorristrevnorris left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes look good. Thanks for the cleanup.

Improve error messages in the async hooks tests, mostly by removing
unhelpful `message` parameters for assertions.
@addaleax
addaleaxforce-pushed the async-hooks-test-message branch from e76c106 to acbdc64CompareJune 3, 2017 09:46
@addaleax

Copy link
Copy Markdown
MemberAuthor

Rebased. @refack I think the “a day or two before landing” have passed by now, are you okay with reviewing this later and fixing up anything you’d like to see addressed yourself?

CI: https://ci.nodejs.org/job/node-test-commit/10331/

@refack

Copy link
Copy Markdown
Contributor

Rebased. @refack I think the “a day or two before landing” have passed by now, are you okay with reviewing this later and fixing up anything you’d like to see addressed yourself?

CI: https://ci.nodejs.org/job/node-test-commit/10331/

Yep.

@addaleax

Copy link
Copy Markdown
MemberAuthor

Landed in 1dc3272

@addaleaxaddaleax closed this Jun 3, 2017
@addaleax
addaleax deleted the async-hooks-test-message branch June 3, 2017 21:11
addaleax added a commit that referenced this pull request Jun 3, 2017
Improve error messages in the async hooks tests, mostly by removing
unhelpful `message` parameters for assertions.
PR-URL: #13243
Reviewed-By: Kunal Pathak <kunal.pathak@microsoft.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
jasnell pushed a commit that referenced this pull request Jun 5, 2017
Improve error messages in the async hooks tests, mostly by removing
unhelpful `message` parameters for assertions.
PR-URL: #13243
Reviewed-By: Kunal Pathak <kunal.pathak@microsoft.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
@jasnelljasnell mentioned this pull request Jun 5, 2017
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

async_hooksIssues and PRs related to the async hooks subsystem.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@addaleax@refack@jasnell@trevnorris@AndreasMadsen@cjihrig@kunalspathak@nodejs-github-bot