-
-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy pathjest.config.js
More file actions
52 lines (51 loc) · 1.62 KB
/
jest.config.js
File metadata and controls
52 lines (51 loc) · 1.62 KB
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
/** @type {import('jest').Config} */
const config = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
setupFiles: ['<rootDir>/jest.setup.canvas.js'],
testEnvironment: 'jest-environment-jsdom',
resolver: '<rootDir>/jest.resolver.js',
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'^canvas$': '<rootDir>/src/__mocks__/node-canvas.js',
'^canvas/(.*)$': '<rootDir>/src/__mocks__/node-canvas.js',
'^three/examples/jsm/(.*)$':
'<rootDir>/src/__mocks__/three/examples/jsm/$1',
// Next.js internal modules
'^next/dist/(.*)$': '<rootDir>/node_modules/next/dist/$1',
// Reactコンポーネントのモック
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
},
testMatch: ['**/__tests__/**/*.test.[jt]s?(x)'],
modulePathIgnorePatterns: [
'node_modules/canvas',
'node_modules/@ffmpeg-installer',
'node_modules/fluent-ffmpeg',
],
transform: {
'^.+\\.(ts|tsx|js|jsx)$': [
'ts-jest',
{
tsconfig: {
jsx: 'react-jsx',
esModuleInterop: true,
module: 'commonjs',
moduleResolution: 'node',
resolveJsonModule: true,
allowJs: true,
strict: true,
paths: {
'@/*': ['./src/*'],
},
baseUrl: '.',
},
},
],
},
transformIgnorePatterns: [
'node_modules/(?!(@pixiv/three-vrm|three/examples/jsm|pdfjs-dist|i18next|idb))',
],
moduleDirectories: ['node_modules', '<rootDir>/src/__mocks__'],
testPathIgnorePatterns: ['/node_modules/', '/\\.next/'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
}
module.exports = config