Repository navigation
test(client-utils): build the compact reference from NumberFormatPresets.compact - #11925
Merged
Merged
Conversation
…ets.compact The native reference left out the preset's minimumFractionDigits: 0. Node 22 then defaults to the currency's 2 decimals ($1.50M), so the Hermes parity test failed on the Node 22 CI shard.
Contributor
🛑 Files requiring codeowner reviewTo merge this PR, you'll need to get approvals from the following owner groups. (Note: For files with multiple owners, approval from one owner is sufficient.) @MetaMask/core-extension-ux or @MetaMask/mobile-core-ux (1 file)
|
georgewrmarshall
approved these changes
Dec 4, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explanation
Main has failed on the Node 22 test shard since #11863 merged. This fixes the test. The published package does not change.
formatCurrency(value, 'CAD', NumberFormatPresets.compact)with nativeIntl.NumberFormatoutput.minimumFractionDigits: 0.$1.5M. Node 22 follows the older Intl rules and defaults it to the currency's 2 decimals, so the reference gave$1.50M.NumberFormatPresets.compact, so it always matches the preset.Verified locally: on Node 22.23.5 the test fails without this change (same 2 failures as CI) and passes with it. Node 24 passes all 415 client-utils tests.
References
Test (22.x, 25))Checklist
Note
Low Risk
Test-only change in client-utils; no runtime or published package behavior changes.
Overview
Fixes failing Node 22 Hermes parity tests in
intl-fallbacks.test.tsby aligning the nativeIntl.NumberFormatreference with the formatter under test.The
compactCurrencyoptions object now spreadsNumberFormatPresets.compactinstead of only settingnotationandmaximumFractionDigitsmanually. That preset includesminimumFractionDigits: 0, which Node 24+ effectively applies for compact currency but Node 22 still treats as the currency default (2 decimals), so the old reference produced$1.50MwhileformatCurrency(..., compact)produced$1.5M.No production code changes—test-only fix to unblock CI and the client-utils release.
Reviewed by Cursor Bugbot for commit dd921ab. Configure here.