test: avoid RegExp.prototype.test in crypto error assertion#61183
test: avoid RegExp.prototype.test in crypto error assertion#61183cruzz77 wants to merge 1 commit intonodejs:mainfrom
Conversation
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61183 +/- ##
==========================================
- Coverage 88.53% 88.53% -0.01%
==========================================
Files 703 703
Lines 208598 208598
Branches 40227 40221 -6
==========================================
- Hits 184674 184673 -1
+ Misses 15951 15950 -1
- Partials 7973 7975 +2 π New features to boost your workflow:
|
|
It's not so much that we're avoiding assert(re.test(x), message)since this should instead be expressed as assert.match(x, re, message)or simply assert.match(x, re)In this instance, because the expression being asserted is actually an |
|
|
|
Thanks for the clarification. I misunderstood the scope of the pattern being avoided also given that Appreciate the review and the explanation, and looking forward to contributing further to the community. |
This PR updates
test/parallel/test-crypto-no-algorithm.jsto align with the ongoing test cleanup and modernization work across the Node.js codebase.As part of recent efforts, tests are being standardized to avoid using
RegExp.prototype.test()directly inside assertions in favor of clearer, more explicit matching patterns. This change applies that same approach to a crypto test that validates OpenSSL error output.What was changed
Previously:
Updated to:
Why this change
RegExp.prototype.test()Additional notes