-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.base-config.cjs
76 lines (65 loc) · 1.74 KB
/
jest.base-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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* For a detailed explanation regarding each configuration property and type check, visit:
* https://jestjs.io/docs/configuration
*/
/**
* @type {import('@jest/types').Config.InitialOptions}
* @see https://jestjs.io/docs/configuration
**/
const jestConfig = {
clearMocks: true,
reporters: ['default', ['jest-junit', { outputDirectory: './coverage' }]],
collectCoverage: false,
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'node_modules/**',
'!**/*.d.ts',
],
coverageDirectory: './coverage',
coveragePathIgnorePatterns: ['/node_modules/'],
coverageProvider: 'babel',
coverageReporters: ['text', 'cobertura'],
moduleFileExtensions: [
'js',
'mjs',
'cjs',
'jsx',
'ts',
'tsx',
'json',
'node',
],
moduleNameMapper: {
'\\.(scss|sass|css)$': 'identity-obj-proxy',
'^.+\\.(jpg|jpeg|png|gif|webp|avif|svg)$': '<rootDir>/fileMock.js',
},
roots: ['<rootDir>/src'],
moduleDirectories: ['node_modules', 'src'],
setupFilesAfterEnv: ['./jest.setup.ts'],
testEnvironment: 'jsdom',
testEnvironmentOptions: {
customExportConditions: [], // don't load "browser" field
},
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'],
transform: {
'^.+\\.(js|jsx|ts|tsx)$': [
'babel-jest',
{
presets: [
[
'@babel/preset-env',
{ targets: { node: 'current' }, modules: 'commonjs', loose: true },
],
'@babel/preset-typescript',
['@babel/preset-react', { runtime: 'automatic' }],
],
},
],
},
transformIgnorePatterns: [
'/node_modules/(?!@lotta-schule)',
'\\.pnp\\.[^\\/]+$',
'^.+\\.module\\.(css|sass|scss)$',
],
};
module.exports = jestConfig;