test: fix compatibility with newer Node.js 22+#1714
Conversation
Node.js 22+ changed the SSL error code format from 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE' to 'ERR_SSL_SSL/TLS_ALERT_HANDSHAKE_FAILURE'. Update the test to accept both formats so it passes on both old and new Node.js versions.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1714 +/- ##
=======================================
Coverage 79.92% 79.92%
=======================================
Files 90 90
Lines 4887 4887
Branches 920 920
=======================================
Hits 3906 3906
Misses 676 676
Partials 305 305 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code ReviewThank you for this PR! This is a well-targeted fix for Node.js 22+ compatibility. Here's my detailed review: ✅ Strengths
🔍 Observations & Suggestions1. CI Coverage Gap (Important)Looking at
Recommendation: Consider adding Node.js 22.x to the CI matrix in a follow-up PR to ensure this fix is actually tested and prevent regressions. 2. Error Message Assertion OrderThe assertion for error codes at lines 567-570 lists the old format first, then the new format. For consistency and future-proofing, consider listing them in chronological order (old to new) or in the order of likelihood. The current order is fine, but you could add a brief note about which is which: assert.include(
['ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE', // Node.js < 22
'ERR_SSL_SSL/TLS_ALERT_HANDSHAKE_FAILURE'], // Node.js >= 22
(err as Error & { code?: string }).code
);This is optional but improves readability. 3. Testing Framework CompatibilityThe change uses Chai's 🐛 Potential IssuesNone identified - The implementation is sound. ⚡ PerformanceNo performance concerns - the change is in test code only. 🔒 SecurityNo security concerns - this is a test-only change. 🧪 Test CoverageThe change improves test coverage by making the test pass on both old and new Node.js versions. However, as noted above, Node.js 22 should be added to the CI matrix to validate this fix. 📝 Code Quality
Final Recommendation✅ Approve with suggestions This is a clean, targeted fix that solves a real compatibility issue. The implementation is correct and follows existing patterns in the codebase. Suggested next steps:
Great work! Review generated by Claude Code |
|
🎉 This PR is included in version 19.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Node.js 22+ changed the SSL error code format from 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE' to
'ERR_SSL_SSL/TLS_ALERT_HANDSHAKE_FAILURE'. Update the test to accept both formats so it passes on both old and new Node.js versions.