Ste*_*unk 7 unit-testing npm jestjs react-native expo
我已经按照以下教程安装 Jest with expo。 https://docs.expo.io/versions/latest/guides/testing-with-jest/
遵循本教程后,我遇到了这些错误:
react-native/jest-preset contained different transformIgnorePatterns than expected
FAIL __test__/App.test.js
? Test suite failed to run
Cannot find module '@unimodules/react-native-adapter' from 'setup.js'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:230:17)
at Object.<anonymous> (node_modules/jest-expo/src/preset/setup.js:218:6)
Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.348s
Ran all test suites.
npm ERR! Test failed. See above for more details.
Run Code Online (Sandbox Code Playgroud)
现在我可以使用npm install @unimodules/react-native-adapter --save-dev. 但这会导致以下错误
The Expo SDK requires Expo to run. It appears the native Expo modules are unavailable and this code is not running on Expo. Visit https://docs.expo.io to learn more about developing an Expo project.
at Object.<anonymous> (node_modules/expo/src/environment/validate.ts:11:9)
at Object.require (node_modules/expo/build/Expo.js:278:1)
console.warn node_modules/expo-react-native-adapter/build/NativeModulesProxy.js:43
The "ExpoNativeModulesProxy" native module is not exported through NativeModules; verify that expo-react-native-adapter's native code is linked properly
console.warn node_modules/expo-constants/build/Constants.js:4
No native ExponentConstants module found, are you sure the expo-constants's module is linked properly?
Run Code Online (Sandbox Code Playgroud)
我尝试通过遵循许多谷歌链接来解决这个问题,我尝试了以下方法:
| 归档时间: |
|
| 查看次数: |
681 次 |
| 最近记录: |