forked from facebook/lexical
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
126 lines (122 loc) · 5.63 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
124
125
126
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
'use strict';
const common = {
modulePathIgnorePatterns: ['/npm'],
};
module.exports = {
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.ts',
'^@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/html$': '<rootDir>/packages/lexical-html/src/index.ts',
'^@lexical/link$': '<rootDir>/packages/lexical-link/src/index.ts',
'^@lexical/list$': '<rootDir>/packages/lexical-list/src/index.ts',
'^@lexical/mark$': '<rootDir>/packages/lexical-mark/src/index.ts',
'^@lexical/markdown$':
'<rootDir>/packages/lexical-markdown/src/index.ts',
'^@lexical/offset$': '<rootDir>/packages/lexical-offset/src/index.ts',
'^@lexical/overflow$':
'<rootDir>/packages/lexical-overflow/src/index.ts',
'^@lexical/plain-text$':
'<rootDir>/packages/lexical-plain-text/src/index.ts',
'^@lexical/react/LexicalAutoEmbedPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalAutoEmbedPlugin.tsx',
'^@lexical/react/LexicalAutoLinkPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalAutoLinkPlugin.ts',
'^@lexical/react/LexicalCheckListPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalCheckListPlugin.ts',
'^@lexical/react/LexicalCollaborationContext$':
'<rootDir>/packages/lexical-react/src/LexicalCollaborationContext.ts',
'^@lexical/react/LexicalCollaborationPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalCollaborationPlugin.ts',
'^@lexical/react/LexicalComposerContext$':
'<rootDir>/packages/lexical-react/src/LexicalComposerContext.ts',
'^@lexical/react/LexicalContentEditable$':
'<rootDir>/packages/lexical-react/src/LexicalContentEditable.tsx',
'^@lexical/react/LexicalLinkPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalLinkPlugin.ts',
'^@lexical/react/LexicalListPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalListPlugin.ts',
'^@lexical/react/LexicalPlainTextPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalPlainTextPlugin.ts',
'^@lexical/react/LexicalTabIndentationPlugin$':
'<rootDir>/packages/lexical-react/src/LexicalTabIndentationPlugin.tsx',
'^@lexical/react/LexicalTablePlugin$':
'<rootDir>/packages/lexical-react/src/LexicalTablePlugin.ts',
'^@lexical/react/useLexicalCanShowPlaceholder$':
'<rootDir>/packages/lexical-react/src/useLexicalCanShowPlaceholder.ts',
'^@lexical/react/useLexicalDecorators$':
'<rootDir>/packages/lexical-react/src/useLexicalDecorators.ts',
'^@lexical/react/useLexicalEditable$':
'<rootDir>/packages/lexical-react/src/useLexicalEditable.ts',
'^@lexical/react/useLexicalEditor$':
'<rootDir>/packages/lexical-react/src/useLexicalEditor.ts',
'^@lexical/react/useLexicalSubscription$':
'<rootDir>/packages/lexical-react/src/useLexicalSubscription.ts',
'^@lexical/rich-text$':
'<rootDir>/packages/lexical-rich-text/src/index.ts',
'^@lexical/selection$':
'<rootDir>/packages/lexical-selection/src/index.ts',
'^@lexical/table$': '<rootDir>/packages/lexical-table/src/index.ts',
'^@lexical/text$': '<rootDir>/packages/lexical-text/src/index.ts',
'^@lexical/utils$': '<rootDir>/packages/lexical-utils/src/index.ts',
'^@lexical/yjs$': '<rootDir>/packages/lexical-yjs/src/index.ts',
'^lexical$': '<rootDir>/packages/lexical/src/index.ts',
'^shared/canUseDOM$': '<rootDir>/packages/shared/src/canUseDOM.ts',
'^shared/caretFromPoint$':
'<rootDir>/packages/shared/src/caretFromPoint.ts',
'^shared/environment$': '<rootDir>/packages/shared/src/environment.ts',
'^shared/invariant$': '<rootDir>/packages/shared/src/invariant.ts',
'^shared/normalizeClassNames$':
'<rootDir>/packages/shared/src/normalizeClassNames.ts',
'^shared/simpleDiffWithCursor$':
'<rootDir>/packages/shared/src/simpleDiffWithCursor.ts',
'^shared/useLayoutEffect$':
'<rootDir>/packages/shared/src/useLayoutEffect.ts',
'^shared/warnOnlyOnce$':
'<rootDir>/packages/shared/src/warnOnlyOnce.ts',
formatProdErrorMessage:
'<rootDir>/scripts/error-codes/formatProdErrorMessage.js',
},
preset: 'ts-jest',
testEnvironment: 'jsdom',
testMatch: ['**/__tests__/unit/**/*.test{.ts,.tsx,.js,.jsx}'],
transform: {
'^.+\\.jsx?$': 'babel-jest',
'^.+\\.tsx$': 'ts-jest',
},
},
{
...common,
displayName: 'e2e',
testMatch: [
'**/__tests__/e2e/**/*.js',
'**/__tests__/regression/**/*.js',
],
},
],
};