Skip to content

test(client-utils): build the compact reference from NumberFormatPresets.compact - #11925

Merged
vinnyhoward merged 1 commit into
mainfrom
fix-tmcu-386-client-utils-compact-test-node22
Dec 4, 2026
Merged

vinnyhoward merged 1 commit into
mainfrom
fix-tmcu-386-client-utils-compact-test-node22

Conversation

@vinnyhoward

@vinnyhoward vinnyhoward commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

Main has failed on the Node 22 test shard since #11863 merged. This fixes the test. The published package does not change.

  • The Hermes parity test compares formatCurrency(value, 'CAD', NumberFormatPresets.compact) with native Intl.NumberFormat output.
  • The native reference options left out the preset's minimumFractionDigits: 0.
  • Node 24+ defaults that minimum to 0 for compact notation, so both sides gave $1.5M. Node 22 follows the older Intl rules and defaults it to the currency's 2 decimals, so the reference gave $1.50M.
  • The reference now spreads 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

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

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.ts by aligning the native Intl.NumberFormat reference with the formatter under test.

The compactCurrency options object now spreads NumberFormatPresets.compact instead of only setting notation and maximumFractionDigits manually. That preset includes minimumFractionDigits: 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.50M while formatCurrency(..., 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.

…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.
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

🛑 Files requiring codeowner review

To 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)
  • packages/client-utils/src/formatters/intl-fallbacks.test.ts

@vinnyhoward
vinnyhoward deployed to default-branch December 4, 2026 01:15 — with GitHub Actions Active
@vinnyhoward
vinnyhoward added this pull request to the merge queue Dec 4, 2026
Merged via the queue into main with commit f4a0769 Dec 4, 2026
50 checks passed
@vinnyhoward
vinnyhoward deleted the fix-tmcu-386-client-utils-compact-test-node22 branch December 4, 2026 02:38

This branch was successfully deployed

1 active deployment
default-branch — dd921ab0 Deployed Dec 4, 2026 by vinnyhoward via Determine whether this PR is a release PR #7974
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants