This repository has been archived by the owner on Mar 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
jest.config.ts
63 lines (57 loc) · 1.5 KB
/
jest.config.ts
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
import type {Config} from '@jest/types';
const testFileGlob = './**/+(*.)+(spec|test).ts?(x)';
const dependenciesExclusionGlob = '!**/node_modules/**';
const cypressExclusionGlobs = [
// No files from hidden cypress folder
'!**/.cypress/**',
// No files from cypress folder
'!**/cypress/**',
];
const config: Config.InitialOptions = {
// Basic options
testEnvironment: 'jsdom',
transform: {
'^.+\\.(js|jsx|mjs|cjs|ts|tsx)$': './test/transformers/babel.js',
'^.+\\.css$': './test/transformers/css.js',
'^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)': './test/transformers/file.js',
},
resetMocks: true,
testMatch: [
// Include test files
testFileGlob,
// Exclude dependencies
dependenciesExclusionGlob,
// Exclude cypress files
...cypressExclusionGlobs,
],
// Avoid some long-running test giving false-positive
testTimeout: 20000,
// Setup / Teardown
setupFiles: [
'dotenv/config',
'react-app-polyfill/jsdom',
],
setupFilesAfterEnv: [
'./test/jest.setup.ts',
],
// Coverage
collectCoverageFrom: [
// Include all `ts` or `tsx` files in `src`
'./src/**/*.ts?(x)',
// Exclude test files
`!${testFileGlob}`,
// Exclude dependencies
dependenciesExclusionGlob,
// Exclude cypress files
...cypressExclusionGlobs,
// Exclude type definition files
'!./**/*.d.ts',
],
coverageDirectory: '.',
coverageReporters: [
'clover',
'cobertura',
],
};
// noinspection JSUnusedGlobalSymbols
export default config;