-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathjest.config.js
63 lines (63 loc) · 1.61 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
62
63
/** @type {import('jest').Config} */
module.exports = {
testEnvironment: 'jsdom',
collectCoverageFrom: [
// 'apps/**/*.{ts,tsx}',
'packages/**/*.{ts,tsx}',
'!packages/**/*.stories.{ts,tsx}',
'!packages/{storybook,theme,icons,core}/**/*',
],
// TODO: update test cases and uncomment this
// coverageThreshold: {
// 'apps/**/*.{ts,tsx}': {
// branches: 80,
// functions: 80,
// lines: 80,
// statements: -10,
// },
// 'packages/**/*.{ts,tsx}': {
// branches: 80,
// functions: 80,
// lines: 80,
// statements: -10,
// },
// },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
modulePathIgnorePatterns: [
// Add patterns to ignore
'[/\\\\](dist|build|.next)[/\\\\].+\\.(js|jsx|d.ts)$',
'<rootDir>/config',
'<rootDir>/packages/(icons|theme|storybook)/',
'[/\\\\](packages|apps)[/\\\\].+\\.(config|stories).(js|ts|tsx)$',
],
transform: {
'^.+\\.(t|j)sx?$': [
'@swc/jest',
{
jsc: {
transform: {
react: {
runtime: 'automatic',
},
},
},
},
],
},
moduleNameMapper: {
// Handle module aliases
'^~cpn/(.*)$': '<rootDir>/apps/mochi-web/components/$1',
'^~(.*)$': '<rootDir>/apps/mochi-web/$1',
},
transformIgnorePatterns: [`node_modules/(?!(?:.pnpm/)?(flat))`],
setupFilesAfterEnv: ['@testing-library/jest-dom', './scripts/setup-test.ts'],
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json',
},
},
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
}