test: Add regex check to error expectation#10038
test: Add regex check to error expectation#10038samshull wants to merge 2 commits intonodejs:masterfrom samshull:error-expectation
Conversation
Creating a buffer from a number should throw an error with a message that describes the issue.
|
@samshull just so you know you can force push over branches on github to update a PR. This will allow you to make changes to a commit without needing to open a new PR |
|
@thealphanerd, yes, I understand force push, I created a second branch because I had multiple PRs that could not be submitted from the same branch and could not create a branch off a branch because of the fork requirements of github. Edit: I had two PRs, but different code in each. |
| assert.throws(function() { | ||
| Buffer.from(10, 'hex'); | ||
| }); | ||
| }, /argument must not be a number/); |
There was a problem hiding this comment.
It would be better to test the whole error message:
/^TypeError: "value" argument must not be a number$/
There was a problem hiding this comment.
What is the benefit of full text message checking?
There was a problem hiding this comment.
@samshull it helps tracking changes in the error message/type as those changes are breaking changes (semver-major).
|
@jasnell change submitted |
|
@jasnell It appears that your comment has been addressed. Can you take a look and, if so, please update your review so we can land this? Thanks! |
|
Landed bae695f |
Creating a buffer from a number should throw an error with a message that describes the issue. PR-URL: #10038 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Creating a buffer from a number should throw an error with a message that describes the issue. PR-URL: #10038 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Creating a buffer from a number should throw an error with a message that describes the issue. PR-URL: #10038 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Creating a buffer from a number should throw an error with a message that describes the issue. PR-URL: #10038 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Checklist
make -j8 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
test
Description of change
Creating a buffer from a number should throw an error with a message
that describes the issue.