forked from facebook/lexical
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
123 lines (121 loc) · 5.54 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
'use strict';
const common = {
modulePathIgnorePatterns: ['/npm'],
};
module.exports = {
collectCoverage: true,
collectCoverageFrom: [
'<rootDir>/packages/lexical/src/core/**/*.js',
'<rootDir>/packages/lexical/src/extensions/**/*.js',
'<rootDir>/packages/lexical-react/src/**/*.js',
],
coverageReporters: ['json', 'text'],
projects: [
{
...common,
displayName: 'unit',
globals: {
IS_REACT_ACT_ENVIRONMENT: true,
__DEV__: true,
'ts-jest': {
tsconfig: 'tsconfig.test.json',
},
},
moduleNameMapper: {
'^./dist/(.+)': './src/$1',
'^@lexical/clipboard$':
'<rootDir>/packages/lexical-clipboard/src/index.js',
'^@lexical/code$': '<rootDir>/packages/lexical-code/src/index.ts',
'^@lexical/dragon$': '<rootDir>/packages/lexical-dragon/src/index.ts',
'^@lexical/file$': '<rootDir>/packages/lexical-file/src/index.ts',
'^@lexical/hashtag$': '<rootDir>/packages/lexical-hashtag/src/index.ts',
'^@lexical/headless$':
'<rootDir>/packages/lexical-headless/src/index.ts',
'^@lexical/history$': '<rootDir>/packages/lexical-history/src/index.ts',
'^@lexical/link$': '<rootDir>/packages/lexical-link/src/index.js',
'^@lexical/list$': '<rootDir>/packages/lexical-list/src/index.js',
'^@lexical/mark$': '<rootDir>/packages/lexical-mark/src/index.js',
'^@lexical/offset$': '<rootDir>/packages/lexical-offset/src/index.js',
'^@lexical/overflow$':
'<rootDir>/packages/lexical-overflow/src/index.js',
'^@lexical/plain-text$':
'<rootDir>/packages/lexical-plain-text/src/index.ts',
'^@lexical/react/DEPRECATED_useLexicalRichText$':
'<rootDir>/packages/lexical-react/src/DEPRECATED_useLexicalRichText.js',
'^@lexical/react/LexicalAutoLinkPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalAutoLinkPlugin.js',
'^@lexical/react/LexicalAutoScrollPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalAutoScrollPlugin.js',
'^@lexical/react/LexicalCheckListPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalCheckListPlugin.js',
'^@lexical/react/LexicalCollaborationPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalCollaborationPlugin.js',
'^@lexical/react/LexicalComposerContext$':
'<rootDir>/packages/lexical-react/src/LexicalComposerContext.js',
'^@lexical/react/LexicalContentEditable$':
'<rootDir>/packages/lexical-react/src/LexicalContentEditable.jsx',
'^@lexical/react/LexicalLinkPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalLinkPlugin.js',
'^@lexical/react/LexicalListPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalListPlugin.js',
'^@lexical/react/LexicalPlainTextPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalPlainTextPlugin.js',
'^@lexical/react/LexicalTablePlugin$':
'<rootDir>/packages/lexical-react/src/LexicalTablePlugin.js',
'^@lexical/react/useLexicalCanShowPlaceholder$':
'<rootDir>/packages/lexical-react/src/useLexicalCanShowPlaceholder.js',
'^@lexical/react/useLexicalDecorators$':
'<rootDir>/packages/lexical-react/src/useLexicalDecorators.js',
'^@lexical/react/useLexicalEditor$':
'<rootDir>/packages/lexical-react/src/useLexicalEditor.js',
'^@lexical/rich-text$':
'<rootDir>/packages/lexical-rich-text/src/index.ts',
'^@lexical/selection$':
'<rootDir>/packages/lexical-selection/src/index.js',
'^@lexical/table$': '<rootDir>/packages/lexical-table/src/index.js',
'^@lexical/text$': '<rootDir>/packages/lexical-text/src/index.js',
'^@lexical/utils$': '<rootDir>/packages/lexical-utils/src/index.js',
'^@lexical/yjs$': '<rootDir>/packages/lexical-yjs/src/index.js',
'^lexical$': '<rootDir>/packages/lexical/src/index.js',
'^shared-ts/canUseDOM$':
'<rootDir>/packages/shared-ts/src/canUseDOM.ts',
'^shared-ts/environment$':
'<rootDir>/packages/shared-ts/src/environment.ts',
'^shared-ts/getDOMSelection$':
'<rootDir>/packages/shared-ts/src/getDOMSelection.ts',
'^shared-ts/invariant$':
'<rootDir>/packages/shared-ts/src/invariant.ts',
'^shared-ts/simpleDiffWithCursor$':
'<rootDir>/packages/shared-ts/src/simpleDiffWithCursor.ts',
'^shared-ts/useLayoutEffect$':
'<rootDir>/packages/shared-ts/src/useLayoutEffect.ts',
'^shared/canUseDOM$': '<rootDir>/packages/shared/src/canUseDOM.js',
'^shared/environment$': '<rootDir>/packages/shared/src/environment.js',
'^shared/getDOMSelection$':
'<rootDir>/packages/shared/src/getDOMSelection.js',
'^shared/invariant$': '<rootDir>/packages/shared/src/invariant.js',
'^shared/simpleDiffWithCursor$':
'<rootDir>/packages/shared/src/simpleDiffWithCursor.js',
'^shared/useLayoutEffect$':
'<rootDir>/packages/shared/src/useLayoutEffect.js',
formatProdErrorMessage:
'<rootDir>/scripts/error-codes/formatProdErrorMessage.js',
},
preset: 'ts-jest',
testEnvironment: 'jsdom',
testMatch: ['**/__tests__/unit/**/*.test{.ts,.js}'],
transform: {
'^.+\\.jsx?$': 'babel-jest',
'^.+\\.tsx$': 'ts-jest',
},
},
{
...common,
displayName: 'e2e',
testMatch: [
'**/__tests__/e2e/**/*.js',
'**/__tests__/regression/**/*.js',
],
},
],
};