-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
jest.config.ts
48 lines (45 loc) · 1.21 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
import type { JestConfigWithTsJest } from 'ts-jest';
const commonProjectConfig: Exclude<JestConfigWithTsJest['projects'], undefined>[number] = {
transform: {
// eslint-disable-next-line @typescript-eslint/naming-convention
'^.+\\.[t]sx?$': 'ts-jest'
},
setupFilesAfterEnv: ['<rootDir>/tests/setupTests.ts']
};
const config: JestConfigWithTsJest = {
preset: 'ts-jest',
rootDir: './',
projects: [
{
...commonProjectConfig,
displayName: 'jsdom',
testEnvironment: 'jsdom'
},
{
...commonProjectConfig,
displayName: 'node',
testEnvironment: 'node'
}
],
collectCoverageFrom: [
'<rootDir>/src/**/*.ts',
'!<rootDir>/src/index.ts'
],
cacheDirectory: '<rootDir>/tests/cache',
coverageDirectory: '<rootDir>/tests/coverage',
coverageProvider: 'babel',
coverageReporters: ['json', 'text'],
testMatch: [
'<rootDir>tests/**/*(*.)@(test).[tj]s?(x)'
],
errorOnDeprecated: true,
bail: true,
sandboxInjectedGlobals: [
'Function',
'Array',
'String',
'Math',
'Date'
]
};
export default config;