Files
minibits_wallet/jest.config.js
T
minibits-cashandClaude Opus 5.5 459d2fdc97 Upgrade React Native to 0.87.1
Applies the 0.84.0 → 0.87.1 template diff: Gradle 9.4.1, compileSdk and build
tools 37, Kotlin 2.2.0, the AGP 9 opt-outs, proguard-android-optimize,
@react-native/jest-preset and TypeScript 6.

Required by the RN bump: reanimated 4.7.1 and worklets 0.13. Bundled while a
native release is due: screens, safe-area-context, svg, gesture-handler 2.33,
Sentry 7.13, hot-updater 0.36.18, camera-kit 18.0.1, localize, edge-to-edge
and the react-navigation 7.x packages.

The 0.87 strict TypeScript API needs TextInputInstance and ScrollViewInstance
for refs; FlexStyle and StatusBar translucent are gone. Reanimated 4.7 warns
about dependency arrays, which native ignores, so they are removed.

iOS: Folly, boost, glog and fmt now come prebuilt, so the explicit podspec
pods are removed, along with the RN, reanimated and worklets patches. RN 0.87
removed RCTCxxBridge, RCTTextView and @react-native/assets-registry, so
op-sqlite, quick-crypto, quick-base64, Sentry, svg and fast-image (types
only) are patched until their next major versions.

hot-updater 0.33+ requires redeploying the update-check server
(npx hot-updater init) before release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 21:08:40 +02:00

49 lines
3.2 KiB
JavaScript

module.exports = {
preset: '@react-native/jest-preset',
// Only treat *.test/*.spec files as tests. The default preset glob also
// matches every .js file under __tests__, which would pull in the i18n
// scripts (missingTranslations.js etc.) that are run via `yarn test:i18n`.
testMatch: ['**/*.(test|spec).[jt]s?(x)'],
// The `(.*/)?` makes the allowlist apply at any depth: nostr-tools carries its
// own ESM-only @noble copies in a nested node_modules, and those need babel too.
transformIgnorePatterns: [
'node_modules/(?!(.*/)?((jest-)?react-native|@react-native|@react-native-community|@cashu|@noble|@scure|cborg|react-native-flash-message)/)',
],
// Several native or source-shipped packages are unusable under jest, and the
// MODEL layer reaches all of them at import time (Mint -> services barrel ->
// mmkvStorage / keyChain / db). That is what made MST stores impossible to
// instantiate in a test at all; these mappings are what make store tests possible.
moduleNameMapper: {
// cborg (via @gandlaf21/bc-ur) is ESM-only and its exports map has an "import"
// condition only, which jest's CJS resolver cannot satisfy. Point at the entry
// file directly and let babel transform it (see transformIgnorePatterns above).
'^cborg$': '<rootDir>/node_modules/cborg/cborg.js',
// Same shape as the @scure/bip39 mapping below: the package's exports map
// names only the suffixed path, so app code imports it that way. This accepts
// both spellings, for transitive dependencies still using the bare one.
'^@noble/hashes/utils(?:\\.js)?$': '@noble/hashes/utils.js',
// The package's exports map lists ONLY the explicit `.js` subpath, so app code
// imports it that way (moduleResolution is "bundler", which honours exports).
// This accepts both spellings, since a transitive dependency may still use the
// extensionless one, which no resolver can infer from that map.
'^@scure/bip39/wordlists/([^/.]+)(?:\\.js)?$': '@scure/bip39/wordlists/$1.js',
// quick-crypto's native module is unavailable under jest; route to a
// Node `crypto` shim so deps that import it at load time (e.g. bip32) work.
'^react-native-quick-crypto$': '<rootDir>/__mocks__/react-native-quick-crypto.js',
// MMKV and op-sqlite are native. MMKV is Map-backed and behaves; op-sqlite is
// only an import-time shim and throws if a statement is actually executed —
// use node:sqlite with the production SQL for real DB semantics (see the db
// suites).
'^react-native-mmkv$': '<rootDir>/__mocks__/react-native-mmkv.js',
'^@op-engineering/op-sqlite$': '<rootDir>/__mocks__/op-sqlite.js',
// Sentry ships untransformed ESM, so anything importing logService fails to
// parse. Mocking Sentry rather than logService lets the REAL logger load, so
// tests can cover code that logs instead of stubbing the logger away.
'^@sentry/react-native$': '<rootDir>/__mocks__/sentry-react-native.js',
// react-native-localize is a native TurboModule, and src/i18n calls getLocales()
// at module scope — so without this, importing `translate` anywhere makes the
// module unloadable under jest.
'^react-native-localize$': '<rootDir>/__mocks__/react-native-localize.js',
},
}