SA
메인 내용으로 이동

Configuring Jest for React Native

// __mocks__/react-native-geolocation-service.ts
export default {}

export enum PositionError {
PERMISSION_DENIED = 1,
POSITION_UNAVAILABLE = 2,
TIMEOUT = 3,
PLAY_SERVICE_NOT_AVAILABLE = 4,
SETTINGS_NOT_SATISFIED = 5,
INTERNAL_ERROR = -1,
}
// __mocks__/@react-native-async-storage/async-storage.ts
export default '@react-native-async-storage/async-storage/jest/async-storage-mock'
import App from '../src/App'

import renderer from 'react-test-renderer'

describe('<App />', () => {
it('renders correctly', () => {
renderer.create(<App />)
})
})
"jest": {
"preset": "react-native",
"transformIgnorePatterns": [
"node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|rollbar-react-native|@fortawesome|@react-native|@react-navigation)"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
}

이 문서를 언급한 문서들