forked from facebook/lexical
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.mts
More file actions
63 lines (61 loc) · 1.66 KB
/
Copy pathvitest.config.mts
File metadata and controls
63 lines (61 loc) · 1.66 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
63
/**
* 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.
*
*/
import react from '@vitejs/plugin-react';
import {defineConfig} from 'vitest/config';
export default defineConfig({
resolve: {
conditions: ['development', 'import', 'module', 'browser', 'default'],
dedupe: ['react', 'react-dom'],
tsconfigPaths: true,
},
test: {
clearMocks: true,
projects: [
{
define: {
// https://react.dev/blog/2022/03/08/react-18-upgrade-guide#configuring-your-testing-environment
IS_REACT_ACT_ENVIRONMENT: true,
__DEV__: true,
},
extends: true,
plugins: [react()],
test: {
env: {
LEXICAL_VERSION: JSON.stringify(
`${process.env.npm_package_version}+git`,
),
},
environment: 'jsdom',
include: ['packages/**/__tests__/unit/**/*.test{.ts,.tsx,.js,.jsx}'],
name: 'unit',
setupFiles: ['./vitest.setup.mts'],
typecheck: {
tsconfig: './tsconfig.test.json',
},
},
},
{
extends: true,
test: {
environment: 'node',
include: ['scripts/**/__tests__/unit/**/*.test.ts'],
name: 'scripts-unit',
},
},
{
extends: true,
test: {
environment: 'node',
globalSetup: './scripts/__tests__/integration/setup.mjs',
include: ['scripts/__tests__/integration/**/*.test.mjs'],
name: 'integration',
},
},
],
},
});