-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Expand file tree
/
Copy pathvitest.config.ts
More file actions
137 lines (134 loc) · 3.65 KB
/
Copy pathvitest.config.ts
File metadata and controls
137 lines (134 loc) · 3.65 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
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
127
128
129
130
131
132
133
134
135
136
137
import { createRequire } from "node:module";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { defineConfig } from "vitest/config";
import baseConfig from "../../packages/test/vitest/default.config";
const here = path.dirname(fileURLToPath(import.meta.url));
const repoRoot = path.resolve(here, "../..");
const require = createRequire(import.meta.url);
const pluginElizaCloudSrc = path.join(
repoRoot,
"plugins",
"plugin-elizacloud",
"src",
);
const pluginIMessageSrc = path.join(
repoRoot,
"plugins",
"plugin-imessage",
"src",
);
const pluginCodingToolsSrc = path.join(
repoRoot,
"plugins",
"plugin-coding-tools",
"src",
);
const pluginAppManagerSrc = path.join(
repoRoot,
"plugins",
"plugin-app-manager",
"src",
);
const vaultSrc = path.join(repoRoot, "packages", "vault", "src");
const agentSrc = path.join(repoRoot, "packages", "agent", "src");
const baseAliases = Array.isArray(baseConfig.resolve?.alias)
? baseConfig.resolve.alias
: [];
const unitExcludes = [
"dist/**",
"**/node_modules/**",
"**/*.live.test.{ts,tsx}",
"**/*.live.e2e.test.{ts,tsx}",
"**/*.real.test.{ts,tsx}",
"**/*.real.e2e.test.{ts,tsx}",
"**/*.integration.test.{ts,tsx}",
"**/*.e2e.test.{ts,tsx}",
"**/*.e2e.spec.{ts,tsx}",
];
export default defineConfig({
...baseConfig,
resolve: {
...baseConfig.resolve,
alias: [
{
find: /^@elizaos\/plugin-elizacloud$/,
replacement: path.join(pluginElizaCloudSrc, "index.node.ts"),
},
{
find: /^@elizaos\/plugin-elizacloud\/(.+)$/,
replacement: path.join(pluginElizaCloudSrc, "$1"),
},
{
find: /^@elizaos\/plugin-imessage$/,
replacement: path.join(pluginIMessageSrc, "index.ts"),
},
{
find: /^@elizaos\/plugin-imessage\/(.+)$/,
replacement: path.join(pluginIMessageSrc, "$1"),
},
{
find: /^@elizaos\/plugin-discord$/,
replacement: path.join(here, "test", "plugin-discord.stub.ts"),
},
{
find: /^@elizaos\/plugin-coding-tools$/,
replacement: path.join(pluginCodingToolsSrc, "index.ts"),
},
{
find: /^@elizaos\/plugin-coding-tools\/(.+)$/,
replacement: path.join(pluginCodingToolsSrc, "$1"),
},
{
find: /^@elizaos\/plugin-app-manager$/,
replacement: path.join(pluginAppManagerSrc, "index.ts"),
},
{
find: /^@elizaos\/plugin-app-manager\/(.+)$/,
replacement: path.join(pluginAppManagerSrc, "$1"),
},
{
find: /^@elizaos\/vault$/,
replacement: path.join(vaultSrc, "index.ts"),
},
{
find: /^@elizaos\/vault\/(.+)$/,
replacement: path.join(vaultSrc, "$1"),
},
{
find: /^@elizaos\/agent\/(.+)$/,
replacement: path.join(agentSrc, "$1"),
},
{
find: /^@elizaos\/ui$/,
replacement: path.join(repoRoot, "packages/ui/src/index.ts"),
},
{
find: /^react$/,
replacement: path.dirname(require.resolve("react/package.json")),
},
{
find: /^react\/jsx-runtime$/,
replacement: require.resolve("react/jsx-runtime"),
},
{
find: /^react-dom$/,
replacement: path.dirname(require.resolve("react-dom/package.json")),
},
{
find: /^react-dom\/client$/,
replacement: require.resolve("react-dom/client"),
},
...baseAliases,
],
},
test: {
...baseConfig.test,
environment: "node",
include: ["test/**/*.test.ts", "src/**/*.test.ts", "src/**/*.test.tsx"],
exclude: unitExcludes,
globals: false,
passWithNoTests: true,
testTimeout: 30000,
},
});