Conversation
|
LGTM |
1 similar comment
|
LGTM |
|
maybe we could just fix the API? Check if the function accepts 3 args then turn arg 2 into a regex? |
|
that would be more likely to break someone and the assertion API is locked. Likely best to improve the documentation and leave it |
|
@Fishrock123 There are several inter-related problems with "fixing" this issue in the API rather than just documenting it. "Fixing" it would be Maybe it's not clear from the example I'm giving in the doc, but the issue more typically manifests itself like this: In other words, the problem really isn't that someone sends three arguments with the second one as a string. The typical problem (and the one that struck on a test that @jasnell recently fixed) is when there are just two arguments. If you "fix" the API so that when the second argument is a string then it is the error message to check...then you are breaking things for people who are using the API as intended, which is thus: So, even if we "fix" it, at a minimum, we should still document it as in this PR for versions prior to 6. If we "fix" it, then we're introducing a breaking change into a Locked API. So... ¯_(ツ)_/¯ |
|
eh, just document it then |
PR-URL: #6029 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Landed in 539cede |
PR-URL: #6029 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: #6029 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Pull Request check-list
existing APIs, or introduces new ones)?
Affected core subsystem(s)
doc assert
Description of change
assert.throws()has a pitfall where you may think you are checking error message text when you are not. Document it.