-
Notifications
You must be signed in to change notification settings - Fork 97
/
jest.config.js
36 lines (34 loc) · 1.06 KB
/
jest.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const glob = require('glob');
// find all source files that have tests
const findSourceFilesWithTests = () => {
const testFiles = glob.sync('src/**/*.test.{js,jsx,ts,tsx}');
const sourceFiles = testFiles.map(testFile => {
return testFile.replace('.test', '').replace(/__tests__\//, '');
});
return sourceFiles;
};
/** @type {import('jest').Config} */
module.exports = {
preset: 'jest-expo',
transformIgnorePatterns: [
'node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|react-native-svg)',
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
collectCoverage: true,
collectCoverageFrom: [
...findSourceFilesWithTests(),
'!**/coverage/**',
'!**/node_modules/**',
'!**/babel.config.js',
'!**/jest.setup.js',
],
coverageReporters: ['text-summary'],
projects: [
{
preset: 'jest-expo/ios',
},
{
preset: 'jest-expo/android',
},
],
};