tools: enforce two arguments in assert.throws#12270
Conversation
There was a problem hiding this comment.
Matching the complete error message seems fragile. What if V8 changes the wording of the error message?
Would matching the type of error object be sufficient, using the overload of assert.throws() that takes a constructor?
assert.throws(() => { /* some code that throws a TypeError */ }, TypeError);There was a problem hiding this comment.
As above, consider just passing the AssertionError constructor here instead of a regexp.
There was a problem hiding this comment.
Will do. I actually tried to put AssertionError first but realized it's not globally available. Your comment made me look closer and I saw that it is exported by the assert module.
ae3e425 to
efdf030
Compare
This adds RegExp or error constructor arguments to the remaining places where it is missing in preparation for the commit that will enforce the presence of at least two arguments. PR-URL: nodejs#12270 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Enables the requireTwo option of our custom rule. PR-URL: nodejs#12270 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
efdf030 to
a4b9c58
Compare
|
Should this be backported to |
|
@targos when you merge multiple commits, could you still comment with |
|
Backport PR: #13785 |
This adds RegExp or error constructor arguments to the remaining places where it is missing in preparation for the commit that will enforce the presence of at least two arguments. PR-URL: #12270 Backport-PR-URL: #13785 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Enables the requireTwo option of our custom rule. PR-URL: #12270 Backport-PR-URL: #13785 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
This adds RegExp or error constructor arguments to the remaining places where it is missing in preparation for the commit that will enforce the presence of at least two arguments. PR-URL: #12270 Backport-PR-URL: #13785 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Enables the requireTwo option of our custom rule. PR-URL: #12270 Backport-PR-URL: #13785 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
This adds RegExp or error constructor arguments to the remaining places where it is missing in preparation for the commit that will enforce the presence of at least two arguments. PR-URL: #12270 Backport-PR-URL: #13785 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Enables the requireTwo option of our custom rule. PR-URL: #12270 Backport-PR-URL: #13785 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
This adds RegExp or error constructor arguments to the remaining places where it is missing in preparation for the commit that will enforce the presence of at least two arguments. PR-URL: nodejs#12270 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
This adds RegExp or error constructor arguments to the remaining places where it is missing in preparation for the commit that will enforce the presence of at least two arguments. Backport-PR-URL: #19447 PR-URL: #12270 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
This adds RegExp or error constructor arguments to the remaining places where it is missing in preparation for the commit that will enforce the presence of at least two arguments. PR-URL: nodejs/node#12270 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Enables the requireTwo option of our custom rule. PR-URL: nodejs/node#12270 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
First commit adds a RegExp argument to the remaining places where it is missing in preparation for the second commit that enforces the presence of at least two arguments in
assert.throws().Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test, tools