-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.ts
60 lines (57 loc) · 1.54 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
import type { Config } from '@jest/types'
const base: Partial<Config.InitialOptions> = {
/*transformIgnorePatterns: [
'node_modules/?!(@ui-schema)',
],*/
transform: {
// '^.+\\.ts$': 'babel-jest',
'^.+\\.ts$': 'ts-jest',
},
/*extensionsToTreatAsEsm: ['.ts'],
globals: {
'ts-jest': {
useESM: true,
},
},*/
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',// todo: validate ESM testing (and JSDom/react compat.), somehow this mapper was all needed - no further ts-jest/babel adjustments
'^@bemit/redis(.*)$': '<rootDir>/src$1',
},
moduleFileExtensions: [
'ts',
'tsx',
'js',
'jsx',
'json',
'node',
],
collectCoverage: true,
coveragePathIgnorePatterns: [
'(tests/.*.mock).(jsx?|tsx?|ts?|js?)$',
],
verbose: true,
}
const config: Config.InitialOptions = {
...base,
projects: [{
displayName: 'test',
...base,
moduleDirectories: ['node_modules', '<rootDir>/node_modules'],
testMatch: [
'<rootDir>/src/**/*.(test|spec).(js|ts)',
'<rootDir>/tests/**/*.(test|spec).(js|ts)',
],
},
{
displayName: 'lint',
runner: 'jest-runner-eslint',
...base,
testMatch: [
'<rootDir>/src/**/*.(js|ts)',
'<rootDir>/tests/**/*.(test|spec|d).(js|ts)',
],
},
],
coverageDirectory: '<rootDir>/coverage',
}
export default config