Last active
September 11, 2019 21:10
-
-
Save johinsDev/79cf7b4ec07e7c31bc4dd938e2f208f3 to your computer and use it in GitHub Desktop.
TEST React native Config with expo/typescript/react-native-testing-library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| yarn add -D react-dom @testing-library/react-native @types/jest jest react-test-renderer @types/react-test-renderer jest-expo ts-jest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { defaults: tsJestConfig } = require('ts-jest/presets') | |
| const jestPreset = require('@testing-library/react-native/jest-preset') | |
| module.exports = { | |
| ...tsJestConfig, | |
| ...jestPreset, | |
| preset: 'jest-expo', | |
| transformIgnorePatterns: [ | |
| 'node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|sentry-expo|native-base)' | |
| ], | |
| transform: { | |
| ...tsJestConfig.transform, | |
| '\\.js$': '<rootDir>/node_modules/react-native/jest/preprocessor.js' | |
| }, | |
| globals: { | |
| 'ts-jest': { | |
| babelConfig: false, | |
| tsConfig: './tsconfig.jest.json' | |
| } | |
| }, | |
| modulePaths: ['<rootDir>'], | |
| setupFilesAfterEnv: ['@testing-library/react-native/cleanup-after-each'] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment