-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
test: fix tests that check error messages #3727
Conversation
20285ad changed the format of error messages throughout lib. However, the tests were not updated to reflect these changes. This commit makes those changes.
@silverwind @micnic please be sure to always run the tests before landing. :D |
Thanks @cjihrig for picking the slack! LGTM, verified locally as CI seems to still be down. |
@@ -566,7 +566,7 @@ posix.extname = function(path) { | |||
posix.format = function(pathObject) { | |||
if (pathObject === null || typeof pathObject !== 'object') { | |||
throw new TypeError( | |||
"Parameter 'pathObject' must be an object, not " + typeof pathObject | |||
'Parameter "pathObject" must be an object, not ' + typeof pathObject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this one missed in the original commit, by the way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. And it made one of the path
tests a pain to fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@micnic want to do a second pass if there are more errors that were missed, like this one?
LGTM |
1 similar comment
LGTM |
|
||
assert.throws(function() { | ||
new Buffer(null); | ||
}, /must start with number, buffer, array or string/); | ||
}, /must start with number, buffer, array or string/i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why ignore case is necessary in these two places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error string is 'Must start with number, buffer, array or string'
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, why not fix the string itself? That would be better, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do that on the landing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the regex case insensitive because if that were already the case, this test wouldn't have broken at all.
20285ad changed the format of error messages throughout lib. However, the tests were not updated to reflect these changes. This commit makes those changes. PR-URL: #3727 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 2c33819 with the suggested regex change. I'll have a look at the remaining error messages in case more were missed. |
@cjihrig ... should this be looked at for v4.x? |
I don't think so. The PR that updated the error messages was deemed not LTS (#3374). |
This depends on #3374, which makes it a |
20285ad changed the format of error messages throughout lib. However, the tests were not updated to reflect these changes. This commit makes those changes.