-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
assert: allow printf-style messages as assertion error #58849
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: allow printf-style messages as assertion error #58849
Conversation
f6aeff1 to
ae6214e
Compare
Also add functions as allowed message input. This allows to have leavy message computation to become cheaper.
ae6214e to
32e43c2
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #58849 +/- ##
==========================================
- Coverage 88.52% 88.52% -0.01%
==========================================
Files 703 703
Lines 207825 207894 +69
Branches 40003 40016 +13
==========================================
+ Hits 183976 184035 +59
- Misses 15862 15867 +5
- Partials 7987 7992 +5
🚀 New features to boost your workflow:
|
|
@nodejs/assert @marco-ippolito PTAL |
|
@nodejs/tsc PTAL, due to this being semver-major |
|
So the breaking change is that existing calls that happen to have printf syntax in the message give a different output? |
|
@targos for simple assert, using symbols would now throw. That is to make it consistent across the other methods and I think that should be fine to remove. |
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.
Breaking change LGTM
|
Landed in d3f79aa |
|
This is breaking the linter on the main branch https://ci.nodejs.org/job/node-test-linter/62229/ |
#60304 should fix the linter. |
PR-URL: #60304 Refs: #58849 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: #60304 Refs: #58849 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Also add functions as allowed message input.
This allows to have heavy message computation to become cheaper.
This is not yet finished, I just thought I could get some early feedback.
Tests are often not as performance sensitive, so it's not that crucial.
I do like the ergonomics of it as well though and I know I worked around
a test perf issue of this kind in Node.js before.