fix: deprecation warning and test precision #4732
Open
+553
−20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses two minor issues:
Fix
url.parse()deprecation warningNode.js shows a deprecation warning when running the project:
[DEP0169] DeprecationWarning: url.parse() behavior is not standardized and prone to errors...This originates from the proxy-from-env dependency. Since we can't modify the dependency directly, this PR adds a patch-package patch that replaces the deprecated
url.parse()with the WHATWG URL API (new URL()).Relevant files changed:
Fix floating-point test precision in calculateRank.test.js
The "beginner user gets B- rank" test fails with a 1 ULP (Unit in Last Place) difference:
Expected: 65.02918514848255Actual: 65.02918514848257Root cause analysis: The test expectation was computed using a mathematically equivalent but floating-point-different formula than what the actual code produces:
These are algebraically identical but produce different IEEE 754 results due to different intermediate rounding. Both values are correct to ~14 significant digits. The fix updates the expected value to match what the code actually computes.
Relevant files changed:
Test Results