-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathjest.config.js
61 lines (60 loc) · 2.64 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* eslint-disable @typescript-eslint/no-var-requires,no-undef */
const { resolve } = require("path");
// jest.config.js
const { pathsToModuleNameMapper } = require("ts-jest");
// In the following statement, replace `./tsconfig` with the path to your `tsconfig` file
// which contains the path mapping (ie the `compilerOptions.paths` option):
const { compilerOptions } = require("./tsconfig.path");
module.exports = {
testEnvironment: "jest-environment-jsdom",
preset: "jest-expo",
setupFilesAfterEnv: ["<rootDir>/test/setup.tsx", "@testing-library/jest-native/extend-expect"],
modulePaths: [
"node_modules",
"utils", // a utility folder
"__mocks__", // a utility folder
__dirname, // the root directory
],
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
testRegex: ".*\\.spec\\.(ts|tsx)$",
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|@peersyst|@ckb-lumos/hd/node_modules/uuid)",
],
collectCoverageFrom: [
"./src/**/*.(ts|js|tsx|jsx)",
"!./src/**/index.(ts|js|tsx|jsx)",
"!./src/**/*.d.ts",
"!./src/**/mock/**/*",
"!./src/module/api/**/*",
"!./src/script/**/*",
"!./src/**/*.(styles|types).(ts|js|tsx|jsx)",
"!./src/**/*Provider.tsx",
"!./src/module/common/icons/**/*",
"!./src/module/common/style/**/*",
"!./src/module/common/service/BaseStorageService.ts",
"!./src/module/common/hook/(useCachedResources.ts|useColorScheme.ts)",
"!./src/Providers.tsx",
"!./src/Navigator.tsx",
"!./src/**/*NavigatorGroup.(tsx|ts)",
"!./src/Stack.ts",
"!./src/utils/(isWeb|extractTextStyles).ts",
"!./src/module/common/component/layout/PagerView/*",
"!./src/module/common/component/layout/BasePage/*",
"!./src/module/common/component/layout/LogoPage/*",
"!./src/module/common/service/CkbSdkService.ts",
"!./src/module/sdk/**/*",
"!./src/**/query/**/*",
],
coverageDirectory: "./coverage",
coverageThreshold: {
global: {
branches: 50,
statements: 50,
},
},
moduleNameMapper: {
...pathsToModuleNameMapper(compilerOptions.paths || {}, { prefix: resolve(compilerOptions.baseUrl) }),
uuid: "<rootDir>/test/__mocks__/fileMock.js",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/test/__mocks__/fileMock.js",
},
};