-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjest.config.ts
54 lines (49 loc) · 1.37 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
import type { JestConfigWithTsJest } from 'ts-jest'
import { pathsToModuleNameMapper } from 'ts-jest'
import { compilerOptions } from './tsconfig.json'
const common = {
preset: 'ts-jest',
setupFilesAfterEnv: ['<rootDir>/__tests__/setup.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
...pathsToModuleNameMapper(compilerOptions.paths),
},
}
const jestConfig: JestConfigWithTsJest = {
collectCoverage: true,
collectCoverageFrom: [
'<rootDir>/src/**',
'!<rootDir>/src/types/*.ts',
'!<rootDir>/**/*.node.spec.ts',
'!<rootDir>/**/*.browser.spec.ts',
],
coverageReporters: ['text', 'cobertura', 'html'],
coveragePathIgnorePatterns: [
'.*__snapshots__/.*',
],
projects: [
{
...common,
displayName: 'Node',
testEnvironment: 'node',
testMatch: [
'<rootDir>/__tests__/node/**/*.spec.ts',
'<rootDir>/__tests__/*.spec.ts',
'<rootDir>/src/**/*.node.spec.ts',
'<rootDir>/src/**/!(*.node|*.browser).spec.ts',
],
},
{
...common,
displayName: 'Browser',
testEnvironment: 'jest-environment-jsdom',
testMatch: [
'<rootDir>/__tests__/browser/**/*.spec.ts',
'<rootDir>/__tests__/*.spec.ts',
'<rootDir>/src/**/*.browser.spec.ts',
'<rootDir>/src/**/!(*.node|*.browser).spec.ts',
],
},
],
}
export default jestConfig