-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
50 lines (46 loc) · 1.36 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
import type { Config } from '@jest/types';
import { BabelConfig } from 'ts-jest';
const esModules = [
'chalk',
'supports-color',
'@btc-vision/bsi-common',
'@btc-vision/bsi-db',
'@btc-vision/logger',
'@btc-vision/transaction',
'opnet',
].join('|');
const babelConfig: BabelConfig = {
presets: ['@babel/preset-env'],
plugins: [['babel-plugin-transform-import-meta', { module: 'ES6' }]],
};
// @ts-ignore
const config: Config.InitialOptions = {
verbose: true,
rootDir: './',
transform: {
'\\.[jt]s?$': [
'ts-jest',
{
useESM: true,
tsconfig: { allowJs: true },
babelConfig: babelConfig,
},
],
},
modulePathIgnorePatterns: ['packages', 'build', 'node_modules', 'config', 'generic'],
testMatch: [
'<rootPath>/__test__/**/*.test.ts',
'<rootPath>/__test__/*.test.ts',
'<rootDir>/__test__/**/*.test.ts',
'<rootDir>/__test__/*.test.ts',
],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.[jt]s$': '$1',
},
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'node'],
moduleDirectories: ['node_modules', 'src', 'build'],
testEnvironment: 'node',
transformIgnorePatterns: [`/node_modules/(?!${esModules})`, `/build/`],
preset: 'ts-jest/presets/js-with-babel',
};
export default config;