-
Notifications
You must be signed in to change notification settings - Fork 31
/
jest.config.js
48 lines (45 loc) · 1.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
// set default timeZone UTC
process.env.TZ = Intl.DateTimeFormat().resolvedOptions().timeZone;
module.exports = {
// if you're also using typescript
preset: 'ts-jest',
testEnvironment: 'jsdom',
testEnvironmentOptions: {
enzymeAdapter: 'react16',
},
verbose: true,
// registers babel.config.js with jest
transform: {
// '^.+\\.js(x)?$': 'babel-jest',
'^.+\\.(t|j)sx?$': ['@swc/jest'],
'^.+\\.mdx$': '@storybook/addon-docs/jest-transform-mdx',
},
// explicitly include any node libs using ESM modules
// "node_modules/?!(<ESM module here>|<another here>|<etc...>)"
// transformIgnorePatterns: ['node_modules/?!(@gio-design\/icon)', '!(@gio-design/icon)'],
transformIgnorePatterns: ['node_modules/@storybook/(?!(addon-docs)/)'],
// setupFilesAfterEnv: ['<rootDir>/enzyme-adapter.js'],
setupFilesAfterEnv: ['<rootDir>/jest-setup'],
moduleNameMapper: {
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/fileMock.js',
'iconfont.js': '<rootDir>/__mocks__/iconMock.js',
},
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/index.{ts,tsx}',
'!src/**/interface?(s).ts?(x)',
'!src/**/*.stories.{ts,tsx}',
'!src/**/demos/*',
'!src/**/__test?(s)__/*',
'!src/text/Text.tsx',
'!src/typograhy/Text.tsx',
'!src/table/DragTable.tsx',
],
coverageDirectory: './coverage/',
coveragePathIgnorePatterns: ['list-pro/'],
testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'],
testPathIgnorePatterns: ['/node_modules/', '/es/', '/build/', '/dist/'],
};