стек:
- Expo
- React Native
- solana/web3.js
- Jest
Код: Выделить всё
npx jest
FAIL helpers/formatters.test.ts
● Test suite failed to run
Cannot find module 'rpc-websockets' from 'node_modules/@solana/web3.js/lib/index.cjs.js'
Require stack:
node_modules/@solana/web3.js/lib/index.cjs.js
helpers/formatters.ts
helpers/formatters.test.ts
1 | import { SOL_DECIMALS } from '@/constants/solana';
2 | import { DAY, HOUR, MINUTE, MONTH, YEAR } from '@/constants/time';
> 3 | import { PublicKey } from '@solana/web3.js';
| ^
4 | import BN from 'bignumber.js';
5 | import { DateTime } from 'luxon';
6 | import { isAddress as isEvmAddress } from 'viem';
at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:427:11)
at Object. (node_modules/@solana/web3.js/lib/index.cjs.js:17:21)
at Object.require (helpers/formatters.ts:3:1)
at Object.require (helpers/formatters.test.ts:1:1)
module.exports = {
preset: 'jest-expo',
testRegex: '\\.test\\.(jsx?|tsx?)$',
moduleFileExtensions: ['js', 'ts', 'tsx'],
moduleNameMapper: {
'^uuid$': '/node_modules/uuid/wrapper.mjs',
},
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native|@?rpc-websockets|@react-native(-community)?|@solana)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@sentry/react-native|native-base|react-native-svg)',
],
};
< /code>
Кроме того, может ли кто-нибудь объяснить, почему это именно происходит? Но это все еще происходит!
Подробнее здесь: https://stackoverflow.com/questions/794 ... -lib-index