forked from nkzw-tech/fbtee
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
99 lines (95 loc) · 2.53 KB
/
jest.config.js
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import process from 'node:process';
import EnumManifest from './example/.enum_manifest.json' with { type: 'json' };
import CommonStrings from './example/common_strings.json' with { type: 'json' };
process.env.NODE_ENV = 'development';
const globalConfig = {
extensionsToTreatAsEsm: ['.ts', '.tsx'],
testEnvironment: 'node',
testMatch: ['**/__tests__/**/*-test.(js|jsx|ts|tsx)'],
transform: {
'\\.(j|t)sx?$': '<rootDir>/jest-preprocessor.js',
},
};
const root = process.cwd();
export default {
prettierPath: null,
projects: [
{
displayName: '@nkzw/babel-plugin-fbtee',
roots: ['<rootDir>/packages/babel-plugin-fbtee/src'],
transform: {
'\\.(j|t)sx?$': [
'<rootDir>/jest-preprocessor.js',
{
presets: [
[
'./packages/babel-preset-fbtee',
{ fbtCommon: { Accept: '...' } },
],
],
},
],
},
},
{
displayName: '@nkzw/babel-plugin-fbtee-runtime',
roots: ['<rootDir>/packages/babel-plugin-fbtee-runtime'],
},
{
displayName: 'fbtee',
modulePaths: ['<rootDir>/packages/fbtee/src'],
roots: ['<rootDir>/packages/fbtee/src'],
testEnvironment: 'jsdom',
transform: {
'\\.(j|t)sx?$': [
'<rootDir>/jest-preprocessor.js',
{
presets: [
[
'./packages/babel-preset-fbtee',
{ fbtCommon: { Accept: '...' } },
],
],
},
],
},
},
{
displayName: 'example',
modulePaths: [
'<rootDir>/example/src',
'<rootDir>/example/src/example',
'<rootDir>/packages/fbtee/src',
],
roots: ['<rootDir>/example'],
testEnvironment: 'jsdom',
transform: {
'\\.(j|t)sx?$': [
'<rootDir>/jest-preprocessor.js',
{
presets: [
[
'./packages/babel-preset-fbtee',
{
fbtCommon: CommonStrings,
fbtEnumManifest: EnumManifest,
},
],
],
},
],
},
},
{
displayName: '@nkzw/eslint-plugin-fbtee',
modulePaths: ['<rootDir>/packages/eslint-plugin-fbtee'],
roots: ['<rootDir>/packages/eslint-plugin-fbtee/src'],
transform: {
'\\.(j|t)sx?$': ['<rootDir>/jest-preprocessor.js'],
},
},
]
.filter(Boolean)
.map((project) => ({ ...globalConfig, ...project })),
rootDir: root,
};