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. |
|
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. |
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.