-
-
Notifications
You must be signed in to change notification settings - Fork 76
/
jest.config.js
47 lines (46 loc) · 1.32 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
/** @type {import('@jest/types').Config.InitialOptions} */
module.exports = {
roots: ['<rootDir>/demo', '<rootDir>/src'],
collectCoverageFrom: [
'demo/**/*.{js,jsx,ts,tsx}',
'!demo/**/*.d.ts',
'!demo/mocks/**',
// TODO: To report coverage in `src`. They are compiled to `dist` so it's difficult to report coverage directly
],
coveragePathIgnorePatterns: [],
setupFilesAfterEnv: ['<rootDir>/demo/setupTests.js'],
testEnvironment: 'jsdom',
modulePaths: ['<rootDir>/demo'],
transform: {
'^.+\\.(ts|js|tsx|jsx)$': '@swc/jest',
'^.+\\.(css|scss|sass|less)$': '<rootDir>/transforms/css',
'^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|json)$)': '<rootDir>/transforms/file',
},
transformIgnorePatterns: [
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|cjs|ts|tsx)$',
],
moduleNameMapper: {
'^react-native$': 'react-native-web',
// Support import ~
'^~(.*)': '<rootDir>/node_modules/$1',
},
moduleFileExtensions: [
// Place tsx and ts to beginning as suggestion from Jest team
// https://jestjs.io/docs/configuration#modulefileextensions-arraystring
'tsx',
'ts',
'web.js',
'js',
'web.ts',
'web.tsx',
'json',
'web.jsx',
'jsx',
'node',
],
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
resetMocks: true,
};