-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.cjs
53 lines (53 loc) · 1.63 KB
/
jest.config.cjs
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
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
moduleNameMapper: {
'\\.(css|less|sass|scss)$': 'identity-obj-proxy',
'\\.(gif|ttf|eot|svg|png|webp)$': '<rootDir>/__mocks__/fileMock.js',
'^@/(.*)$': '<rootDir>/src/$1',
'^@pages/(.*)$': '<rootDir>/src/pages/$1',
'^@components/(.*)$': '<rootDir>/src/components/$1',
'^@shared/(.*)$': '<rootDir>/src/components/shared/$1',
'^@assets/(.*)$': '<rootDir>/src/assets/$1',
'^@services/(.*)$': '<rootDir>/src/services/$1',
'^@utils/(.*)$': '<rootDir>/src/utils/$1',
'^@store/(.*)$': '<rootDir>/src/store/$1',
'^@constants/(.*)$': '<rootDir>/src/constants/$1',
'^@hooks/(.*)$': '<rootDir>/src/hooks/$1',
},
testMatch: [
'<rootDir>/**/*.test.(js|jsx|ts|tsx)',
'<rootDir>/(tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx))',
],
transform: {
'^.+\\.(js|jsx|ts|tsx)$': [
'ts-jest',
{
diagnostics: {
ignoreCodes: [1343],
},
astTransformers: {
before: [
{
path: 'node_modules/ts-jest-mock-import-meta',
options: {
metaObjectReplacement: {
env: {
// Replicate as .env.local
VITE_API_KEY: 'asdfasdf',
},
},
},
},
],
},
},
],
},
transformIgnorePatterns: ['<rootDir>/node_modules/(?!(firebase|@firebase))'],
fakeTimers: {
enableGlobally: true,
},
};