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: provide info about actual error #19884

Closed

Conversation

BridgeAR
Copy link
Member

@BridgeAR BridgeAR commented Apr 9, 2018

In case a error is caught in assert.doesNotThrow or
assert.doesNotReject it will now also indicate what the real
error message was.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

In case a error is caught in `assert.doesNotThrow` or
`assert.doesNotReject` it will now also indicate what the real
error message was.
@nodejs-github-bot nodejs-github-bot added the assert Issues and PRs related to the assert subsystem. label Apr 9, 2018
}
);

common.expectsError(
Copy link
Member Author

Choose a reason for hiding this comment

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

Duplicated test case.

@BridgeAR BridgeAR added the semver-major PRs that contain breaking changes and should be released in the next major version. label Apr 9, 2018
@@ -839,7 +832,7 @@ common.expectsError(
{
type: assert.AssertionError,
code: 'ERR_ASSERTION',
message: 'Got unwanted exception.\nundefined'
message: 'Got unwanted exception.\nActual message: undefined'
Copy link
Member

Choose a reason for hiding this comment

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

This still uses common.expectsError(), is this wanted?

Copy link
Contributor

Choose a reason for hiding this comment

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

Exactly. This call seems similar to https://github.com/nodejs/node/pull/19884/files#diff-81c8c31c5728ec9ed47700e55d9ceebfL127.

Can't this be changed to assert.throws(...) as well?

@BridgeAR
Copy link
Member Author

BridgeAR commented Apr 9, 2018

@BridgeAR
Copy link
Member Author

Fixed failing test and I added quotes around the actual message to highlight what is part of it. New CI https://ci.nodejs.org/job/node-test-pull-request/14164/

@BridgeAR BridgeAR requested a review from a team April 10, 2018 01:56
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

LGTM

@BridgeAR
Copy link
Member Author

Landed in 2bee799

@BridgeAR BridgeAR closed this Apr 12, 2018
BridgeAR added a commit to BridgeAR/node that referenced this pull request Apr 12, 2018
In case a error is caught in `assert.doesNotThrow` or
`assert.doesNotReject` it will now also indicate what the real
error message was.

PR-URL: nodejs#19884
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
jasnell pushed a commit that referenced this pull request Apr 16, 2018
In case a error is caught in `assert.doesNotThrow` or
`assert.doesNotReject` it will now also indicate what the real
error message was.

PR-URL: #19884
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@BridgeAR BridgeAR deleted the improve-does-not-throw-message branch April 1, 2019 23:40
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. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants