-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
62 lines (61 loc) · 1.74 KB
/
Copy pathjest.config.js
File metadata and controls
62 lines (61 loc) · 1.74 KB
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
/**
* Jest harness — three projects.
*
* - "tokens" : node env (ts-jest), covers the shared core (tokens, variants,
* resolveFontFamily). Fast, no DOM.
* - "web" : jsdom env (ts-jest), resolves .web.tsx ahead of .tsx so web
* components render with @testing-library/react + jest-dom.
* - "native" : react-native preset (babel-jest), resolves .native.tsx ahead
* of .tsx so RN components render with
* @testing-library/react-native. Modal/ScrollView are mocked by
* the preset (children render through), so these tests cover
* behavior — not real scroll/layout.
*/
const tsJest = [
'ts-jest',
{tsconfig: {jsx: 'react-jsx', esModuleInterop: true}},
];
module.exports = {
projects: [
{
displayName: 'tokens',
testEnvironment: 'node',
roots: ['<rootDir>/src'],
testMatch: ['<rootDir>/src/__tests__/**/*.test.ts'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
transform: {'^.+\\.tsx?$': tsJest},
},
{
displayName: 'web',
testEnvironment: 'jsdom',
roots: ['<rootDir>/src'],
testMatch: ['<rootDir>/src/**/*.web.test.tsx'],
moduleFileExtensions: [
'web.tsx',
'web.ts',
'tsx',
'ts',
'jsx',
'js',
'json',
],
transform: {'^.+\\.tsx?$': tsJest},
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
},
{
displayName: 'native',
preset: 'react-native',
roots: ['<rootDir>/src'],
testMatch: ['<rootDir>/src/**/*.native.test.tsx'],
moduleFileExtensions: [
'native.tsx',
'native.ts',
'tsx',
'ts',
'jsx',
'js',
'json',
],
},
],
};