@elizaos/cli 1.3.2 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -0
- package/dist/{bun-exec-6CQHTS4F.js → bun-exec-ULMPAIQC.js} +1 -1
- package/dist/{chunk-E6XYTE3A.js → chunk-D3QSET5H.js} +69 -72
- package/dist/{chunk-FDEDLANP.js → chunk-FQYWRHLX.js} +1 -1
- package/dist/{chunk-T2QDIXGU.js → chunk-FSSUAWXQ.js} +3 -3
- package/dist/{chunk-D3Q2UZLZ.js → chunk-I4L4T7QX.js} +1 -1
- package/dist/{chunk-5GUS4CFO.js → chunk-SMZBJQJR.js} +1 -1
- package/dist/commands/agent/actions/index.js +3 -3
- package/dist/commands/agent/index.js +3 -3
- package/dist/commands/create/actions/index.js +4 -4
- package/dist/commands/create/index.js +5 -5
- package/dist/index.js +134 -109
- package/dist/{plugin-creator-H26ZLR6H.js → plugin-creator-TCUFII32.js} +2 -2
- package/dist/{registry-433S5F3Y.js → registry-RF6PW3EN.js} +3 -3
- package/dist/templates/plugin-quick-starter/README.md +52 -10
- package/dist/templates/plugin-quick-starter/package.json +2 -2
- package/dist/templates/plugin-quick-starter/src/__tests__/e2e/README.md +140 -0
- package/dist/templates/plugin-quick-starter/src/__tests__/e2e/plugin-quick-starter.e2e.ts +339 -0
- package/dist/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +55 -17
- package/dist/templates/plugin-quick-starter/src/plugin.ts +14 -14
- package/dist/templates/plugin-starter/README.md +124 -49
- package/dist/templates/plugin-starter/package.json +2 -2
- package/dist/templates/plugin-starter/src/__tests__/e2e/README.md +44 -9
- package/{templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts → dist/templates/plugin-starter/src/__tests__/e2e/plugin-starter.e2e.ts} +13 -20
- package/dist/templates/plugin-starter/src/plugin.ts +5 -7
- package/dist/templates/project-starter/README.md +24 -11
- package/dist/templates/project-starter/package.json +4 -4
- package/dist/templates/project-starter/src/__tests__/actions.test.ts +2 -2
- package/dist/templates/project-starter/src/__tests__/e2e/README.md +103 -0
- package/dist/templates/project-starter/src/__tests__/e2e/project-starter.e2e.ts +575 -0
- package/dist/templates/project-starter/src/__tests__/integration.test.ts +1 -1
- package/dist/templates/project-starter/src/__tests__/models.test.ts +3 -3
- package/dist/templates/project-starter/src/__tests__/plugin.test.ts +3 -3
- package/dist/templates/project-starter/src/__tests__/provider.test.ts +2 -2
- package/dist/templates/project-starter/src/index.ts +4 -3
- package/dist/templates/project-starter/src/plugin.ts +5 -5
- package/dist/templates/project-tee-starter/README.md +44 -5
- package/dist/templates/project-tee-starter/package.json +4 -4
- package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/build-order.test.ts +1 -1
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/character.test.ts +1 -1
- package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/config.test.ts +1 -1
- package/dist/templates/project-tee-starter/src/__tests__/e2e/README.md +128 -0
- package/dist/templates/project-tee-starter/src/__tests__/e2e/project-tee-starter.e2e.ts +280 -0
- package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/env.test.ts +1 -1
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/error-handling.test.ts +2 -2
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/events.test.ts +1 -1
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/file-structure.test.ts +2 -2
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/integration.test.ts +2 -2
- package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/models.test.ts +1 -1
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/plugin.test.ts +1 -1
- package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/provider.test.ts +2 -2
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/routes.test.ts +1 -1
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/tee-validation.test.ts +1 -1
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/test-utils.ts +2 -2
- package/{templates/project-tee-starter → dist/templates/project-tee-starter/src}/__tests__/vite-config-utils.ts +14 -2
- package/dist/templates/project-tee-starter/src/index.ts +2 -0
- package/dist/templates/project-tee-starter/src/plugin.ts +19 -7
- package/dist/{utils-DBLSDYBF.js → utils-5HPZSIF6.js} +3 -3
- package/package.json +6 -6
- package/templates/plugin-quick-starter/README.md +52 -10
- package/templates/plugin-quick-starter/package.json +2 -2
- package/templates/plugin-quick-starter/src/__tests__/e2e/README.md +140 -0
- package/templates/plugin-quick-starter/src/__tests__/e2e/plugin-quick-starter.e2e.ts +339 -0
- package/templates/plugin-quick-starter/src/__tests__/plugin.test.ts +55 -17
- package/templates/plugin-quick-starter/src/plugin.ts +14 -14
- package/templates/plugin-starter/README.md +124 -49
- package/templates/plugin-starter/package.json +2 -2
- package/templates/plugin-starter/src/__tests__/e2e/README.md +44 -9
- package/{dist/templates/plugin-starter/src/__tests__/e2e/starter-plugin.ts → templates/plugin-starter/src/__tests__/e2e/plugin-starter.e2e.ts} +13 -20
- package/templates/plugin-starter/src/plugin.ts +5 -7
- package/templates/project-starter/README.md +24 -11
- package/templates/project-starter/package.json +4 -4
- package/templates/project-starter/src/__tests__/actions.test.ts +2 -2
- package/templates/project-starter/src/__tests__/e2e/README.md +103 -0
- package/templates/project-starter/src/__tests__/e2e/project-starter.e2e.ts +575 -0
- package/templates/project-starter/src/__tests__/integration.test.ts +1 -1
- package/templates/project-starter/src/__tests__/models.test.ts +3 -3
- package/templates/project-starter/src/__tests__/plugin.test.ts +3 -3
- package/templates/project-starter/src/__tests__/provider.test.ts +2 -2
- package/templates/project-starter/src/index.ts +4 -3
- package/templates/project-starter/src/plugin.ts +5 -5
- package/templates/project-tee-starter/README.md +44 -5
- package/templates/project-tee-starter/package.json +4 -4
- package/templates/project-tee-starter/{__tests__ → src/__tests__}/build-order.test.ts +1 -1
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/character.test.ts +1 -1
- package/templates/project-tee-starter/{__tests__ → src/__tests__}/config.test.ts +1 -1
- package/templates/project-tee-starter/src/__tests__/e2e/README.md +128 -0
- package/templates/project-tee-starter/src/__tests__/e2e/project-tee-starter.e2e.ts +280 -0
- package/templates/project-tee-starter/{__tests__ → src/__tests__}/env.test.ts +1 -1
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/error-handling.test.ts +2 -2
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/events.test.ts +1 -1
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/file-structure.test.ts +2 -2
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/integration.test.ts +2 -2
- package/templates/project-tee-starter/{__tests__ → src/__tests__}/models.test.ts +1 -1
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/plugin.test.ts +1 -1
- package/templates/project-tee-starter/{__tests__ → src/__tests__}/provider.test.ts +2 -2
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/routes.test.ts +1 -1
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/tee-validation.test.ts +1 -1
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/test-utils.ts +2 -2
- package/{dist/templates/project-tee-starter → templates/project-tee-starter/src}/__tests__/vite-config-utils.ts +14 -2
- package/templates/project-tee-starter/src/index.ts +2 -0
- package/templates/project-tee-starter/src/plugin.ts +19 -7
- package/dist/templates/plugin-starter/src/tests.ts +0 -6
- package/dist/templates/project-starter/src/__tests__/e2e/index.ts +0 -14
- package/dist/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +0 -246
- package/dist/templates/project-starter/src/__tests__/e2e/project.test.ts +0 -155
- package/dist/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +0 -421
- package/dist/templates/project-tee-starter/e2e/project.test.ts +0 -38
- package/dist/templates/project-tee-starter/e2e/starter-plugin.test.ts +0 -92
- package/templates/plugin-starter/src/tests.ts +0 -6
- package/templates/project-starter/src/__tests__/e2e/index.ts +0 -14
- package/templates/project-starter/src/__tests__/e2e/natural-language.test.ts +0 -246
- package/templates/project-starter/src/__tests__/e2e/project.test.ts +0 -155
- package/templates/project-starter/src/__tests__/e2e/starter-plugin.test.ts +0 -421
- package/templates/project-tee-starter/e2e/project.test.ts +0 -38
- package/templates/project-tee-starter/e2e/starter-plugin.test.ts +0 -92
- /package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/actions.test.ts +0 -0
- /package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/frontend.test.ts +0 -0
- /package/dist/templates/project-tee-starter/{__tests__ → src/__tests__}/utils/core-test-utils.ts +0 -0
- /package/templates/project-tee-starter/{__tests__ → src/__tests__}/actions.test.ts +0 -0
- /package/templates/project-tee-starter/{__tests__ → src/__tests__}/frontend.test.ts +0 -0
- /package/templates/project-tee-starter/{__tests__ → src/__tests__}/utils/core-test-utils.ts +0 -0
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
|
|
4
|
+
// Default output directories
|
|
5
|
+
const DEFAULT_VITE_OUT_DIR = 'dist/frontend';
|
|
6
|
+
const DEFAULT_VITE_VAR_DIR = 'dist/.vite';
|
|
7
|
+
|
|
4
8
|
/**
|
|
5
9
|
* Extracts the Vite output directory from vite.config.ts
|
|
6
10
|
*/
|
|
7
11
|
export async function getViteOutDir(rootDir: string): Promise<string> {
|
|
8
12
|
const viteConfigPath = path.join(rootDir, 'vite.config.ts');
|
|
13
|
+
|
|
14
|
+
// Check if vite config exists
|
|
15
|
+
if (!fs.existsSync(viteConfigPath)) {
|
|
16
|
+
// Return default if config doesn't exist
|
|
17
|
+
return DEFAULT_VITE_OUT_DIR;
|
|
18
|
+
}
|
|
19
|
+
|
|
9
20
|
const configContent = await fs.promises.readFile(viteConfigPath, 'utf-8');
|
|
10
21
|
|
|
11
22
|
// Extract the outDir value using regex
|
|
12
23
|
const outDirMatch = configContent.match(/outDir\s*:\s*['"`]([^'"`]+)['"`]/);
|
|
13
24
|
if (!outDirMatch) {
|
|
14
|
-
|
|
25
|
+
// Return default output directory if outDir configuration is not found in vite.config.ts
|
|
26
|
+
return DEFAULT_VITE_OUT_DIR;
|
|
15
27
|
}
|
|
16
28
|
|
|
17
29
|
let outDir = outDirMatch[1];
|
|
@@ -24,7 +36,7 @@ export async function getViteOutDir(rootDir: string): Promise<string> {
|
|
|
24
36
|
outDir = outDir.replace('${outDir}', varMatch[1]);
|
|
25
37
|
} else {
|
|
26
38
|
// Default fallback
|
|
27
|
-
outDir =
|
|
39
|
+
outDir = DEFAULT_VITE_VAR_DIR;
|
|
28
40
|
}
|
|
29
41
|
}
|
|
30
42
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { logger, type IAgentRuntime, type Project, type ProjectAgent } from '@elizaos/core';
|
|
2
2
|
import teeStarterPlugin, { StarterService } from './plugin.ts';
|
|
3
3
|
import { mrTeeCharacter as character } from './character.ts';
|
|
4
|
+
import ProjectTeeStarterTestSuite from './__tests__/e2e/project-tee-starter.e2e';
|
|
4
5
|
|
|
5
6
|
const initCharacter = ({ runtime }: { runtime: IAgentRuntime }) => {
|
|
6
7
|
logger.info(`Initializing character: ${character.name}`);
|
|
@@ -10,6 +11,7 @@ const initCharacter = ({ runtime }: { runtime: IAgentRuntime }) => {
|
|
|
10
11
|
export const projectAgent: ProjectAgent = {
|
|
11
12
|
character,
|
|
12
13
|
init: async (runtime: IAgentRuntime) => await initCharacter({ runtime }),
|
|
14
|
+
tests: [ProjectTeeStarterTestSuite], // Export tests from ProjectAgent
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
const project: Project = {
|
|
@@ -119,6 +119,18 @@ const deriveEd25519Keypair = (deriveKeyResponse: DeriveKeyResponse): Keypair =>
|
|
|
119
119
|
return Keypair.fromSeed(seedArray.slice(0, 32));
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Checks if an error is a TEE connection error
|
|
124
|
+
* @param error The error to check
|
|
125
|
+
* @returns True if the error is a TEE connection error
|
|
126
|
+
*/
|
|
127
|
+
const isTeeConnectionError = (error: unknown): boolean => {
|
|
128
|
+
return (
|
|
129
|
+
error instanceof Error &&
|
|
130
|
+
(error.message.includes('ENOENT') || error.message.includes('Failed to connect'))
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
|
|
122
134
|
/**
|
|
123
135
|
* Handles TEE key derivation and logging
|
|
124
136
|
*/
|
|
@@ -135,18 +147,18 @@ const handleTeeKeyDerivation = async (config: TeeServiceConfig): Promise<void> =
|
|
|
135
147
|
const ed25519Keypair = deriveEd25519Keypair(deriveKeyResponse);
|
|
136
148
|
|
|
137
149
|
logger.log('ECDSA Key Derived Successfully!');
|
|
138
|
-
logger.log('ECDSA Keypair:'
|
|
139
|
-
logger.log('ED25519 Keypair:'
|
|
150
|
+
logger.log({ address: ecdsaKeypair.address }, 'ECDSA Keypair:');
|
|
151
|
+
logger.log({ publicKey: ed25519Keypair.publicKey }, 'ED25519 Keypair:');
|
|
140
152
|
|
|
141
153
|
const signature = await ecdsaKeypair.signMessage({ message: 'Hello, world!' });
|
|
142
|
-
logger.log('Sign message w/ ECDSA keypair: Hello world!, Signature:
|
|
154
|
+
logger.log({ signature }, 'Sign message w/ ECDSA keypair: Hello world!, Signature:');
|
|
143
155
|
} catch (error) {
|
|
144
156
|
// Handle TEE connection errors gracefully
|
|
145
|
-
if (error
|
|
157
|
+
if (isTeeConnectionError(error)) {
|
|
146
158
|
logger.warn('TEE daemon not available - running in non-TEE mode for testing');
|
|
147
159
|
logger.warn('To run with TEE, ensure tappd is running at /var/run/tappd.sock');
|
|
148
160
|
} else {
|
|
149
|
-
logger.error
|
|
161
|
+
logger.warn({ error }, 'TEE daemon connection failed, running in non-TEE mode:');
|
|
150
162
|
}
|
|
151
163
|
// Continue without TEE functionality for testing
|
|
152
164
|
}
|
|
@@ -289,8 +301,8 @@ const teeStarterPlugin: Plugin = {
|
|
|
289
301
|
MESSAGE_RECEIVED: [
|
|
290
302
|
async (params) => {
|
|
291
303
|
logger.info(
|
|
292
|
-
|
|
293
|
-
|
|
304
|
+
{ preview: params.message?.content?.text?.substring(0, 50) },
|
|
305
|
+
'[MR_TEE_PLUGIN] MESSAGE_RECEIVED event'
|
|
294
306
|
);
|
|
295
307
|
},
|
|
296
308
|
],
|
|
@@ -116,12 +116,12 @@ import {
|
|
|
116
116
|
updateFile,
|
|
117
117
|
validateGitHubToken,
|
|
118
118
|
writeEnvFile
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-D3QSET5H.js";
|
|
120
120
|
import {
|
|
121
121
|
runBunCommand
|
|
122
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-FQYWRHLX.js";
|
|
123
123
|
import "./chunk-GXWWPFBO.js";
|
|
124
|
-
import "./chunk-
|
|
124
|
+
import "./chunk-I4L4T7QX.js";
|
|
125
125
|
import "./chunk-3RG5ZIWI.js";
|
|
126
126
|
export {
|
|
127
127
|
ModuleLoader,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"description": "elizaOS CLI - Manage your AI agents and plugins",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -73,15 +73,15 @@
|
|
|
73
73
|
"typescript": "5.8.3",
|
|
74
74
|
"vite": "^6.3.5"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "f60dd270910361decc4d4e879e8b2f33c5ddfee2",
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@anthropic-ai/claude-code": "^1.0.35",
|
|
79
79
|
"@anthropic-ai/sdk": "^0.54.0",
|
|
80
80
|
"@clack/prompts": "^0.11.0",
|
|
81
|
-
"@elizaos/api-client": "1.
|
|
82
|
-
"@elizaos/core": "1.
|
|
83
|
-
"@elizaos/plugin-sql": "1.
|
|
84
|
-
"@elizaos/server": "1.
|
|
81
|
+
"@elizaos/api-client": "1.4.2",
|
|
82
|
+
"@elizaos/core": "1.4.2",
|
|
83
|
+
"@elizaos/plugin-sql": "1.4.2",
|
|
84
|
+
"@elizaos/server": "1.4.2",
|
|
85
85
|
"bun": "^1.2.17",
|
|
86
86
|
"chalk": "^5.3.0",
|
|
87
87
|
"chokidar": "^4.0.3",
|
|
@@ -17,11 +17,13 @@ This quick-starter template is ideal for:
|
|
|
17
17
|
```
|
|
18
18
|
plugin-quick-starter/
|
|
19
19
|
├── src/
|
|
20
|
-
│ ├── __tests__/ #
|
|
21
|
-
│ │ ├──
|
|
22
|
-
│ │
|
|
23
|
-
│
|
|
24
|
-
│ ├──
|
|
20
|
+
│ ├── __tests__/ # Test directory
|
|
21
|
+
│ │ ├── e2e/ # E2E tests
|
|
22
|
+
│ │ │ ├── plugin-quick-starter.e2e.ts
|
|
23
|
+
│ │ │ └── README.md
|
|
24
|
+
│ │ ├── plugin.test.ts # Component tests
|
|
25
|
+
│ │ └── test-utils.ts # Test utilities
|
|
26
|
+
│ ├── plugin.ts # Main plugin implementation (exports tests)
|
|
25
27
|
│ └── index.ts # Plugin export
|
|
26
28
|
├── scripts/
|
|
27
29
|
│ └── install-test-deps.js # Test dependency installer
|
|
@@ -66,11 +68,11 @@ plugin-quick-starter/
|
|
|
66
68
|
- No frontend frameworks or build tools
|
|
67
69
|
- Fast installation and builds
|
|
68
70
|
|
|
69
|
-
###
|
|
71
|
+
### Comprehensive Testing
|
|
70
72
|
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
- Quick test execution
|
|
73
|
+
- Component tests with Bun test runner for unit testing
|
|
74
|
+
- E2E tests with ElizaOS test runner for integration testing
|
|
75
|
+
- Quick test execution with focused test suites
|
|
74
76
|
|
|
75
77
|
### Backend Focus
|
|
76
78
|
|
|
@@ -174,7 +176,47 @@ bun run format
|
|
|
174
176
|
|
|
175
177
|
## Testing
|
|
176
178
|
|
|
177
|
-
|
|
179
|
+
ElizaOS employs a dual testing strategy:
|
|
180
|
+
|
|
181
|
+
1. **Component Tests** (`src/__tests__/*.test.ts`)
|
|
182
|
+
|
|
183
|
+
- Run with Bun's native test runner
|
|
184
|
+
- Fast, isolated tests using mocks
|
|
185
|
+
- Perfect for TDD and component logic
|
|
186
|
+
|
|
187
|
+
2. **E2E Tests** (`src/__tests__/e2e/*.e2e.ts`)
|
|
188
|
+
- Run with ElizaOS custom test runner
|
|
189
|
+
- Real runtime with actual database (PGLite)
|
|
190
|
+
- Test complete user scenarios
|
|
191
|
+
|
|
192
|
+
### Test Structure
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
src/
|
|
196
|
+
__tests__/ # All tests live inside src
|
|
197
|
+
*.test.ts # Component tests (use Bun test runner)
|
|
198
|
+
e2e/ # E2E tests (use ElizaOS test runner)
|
|
199
|
+
plugin-quick-starter.e2e.ts # E2E test suite
|
|
200
|
+
README.md # E2E testing documentation
|
|
201
|
+
plugin.ts # Export tests here: tests: [QuickStarterPluginTestSuite]
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Running Tests
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# Run all tests (component + e2e)
|
|
208
|
+
elizaos test
|
|
209
|
+
|
|
210
|
+
# Component tests only
|
|
211
|
+
elizaos test component
|
|
212
|
+
# or
|
|
213
|
+
bun test
|
|
214
|
+
|
|
215
|
+
# E2E tests only
|
|
216
|
+
elizaos test e2e
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Writing Component Tests
|
|
178
220
|
|
|
179
221
|
```typescript
|
|
180
222
|
import { describe, it, expect } from 'bun:test';
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"tsup.config.ts"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@elizaos/core": "1.
|
|
44
|
+
"@elizaos/core": "1.4.2",
|
|
45
45
|
"zod": "^3.24.4"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@elizaos/cli": "1.
|
|
48
|
+
"@elizaos/cli": "1.4.2",
|
|
49
49
|
"dotenv": "16.4.5",
|
|
50
50
|
"prettier": "3.5.3",
|
|
51
51
|
"tsup": "8.5.0",
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# E2E Tests for Plugin Quick Starter
|
|
2
|
+
|
|
3
|
+
This directory contains end-to-end tests for the ElizaOS plugin quick starter template.
|
|
4
|
+
|
|
5
|
+
## ElizaOS Testing Philosophy
|
|
6
|
+
|
|
7
|
+
ElizaOS employs a dual testing strategy:
|
|
8
|
+
|
|
9
|
+
1. **Component Tests** (`src/__tests__/*.test.ts`)
|
|
10
|
+
|
|
11
|
+
- Run with Bun's native test runner
|
|
12
|
+
- Fast, isolated tests using mocks
|
|
13
|
+
- Perfect for TDD and component logic
|
|
14
|
+
- Command: `bun test`
|
|
15
|
+
|
|
16
|
+
2. **E2E Tests** (`src/__tests__/e2e/*.e2e.ts`)
|
|
17
|
+
- Run with ElizaOS custom test runner
|
|
18
|
+
- Real runtime with actual database (PGLite)
|
|
19
|
+
- Test complete user scenarios
|
|
20
|
+
- Command: `elizaos test --type e2e`
|
|
21
|
+
|
|
22
|
+
## Overview
|
|
23
|
+
|
|
24
|
+
E2E tests run in a real ElizaOS runtime environment, allowing you to test your plugin's behavior as it would work in production. The quick starter template focuses on minimal, essential functionality to help you get started quickly.
|
|
25
|
+
|
|
26
|
+
## Test Structure
|
|
27
|
+
|
|
28
|
+
- **QuickStarterPluginTestSuite** - Main test suite containing all e2e tests
|
|
29
|
+
- `plugin_should_be_loaded` - Verifies plugin is loaded correctly
|
|
30
|
+
- `should_have_quick_action_registered` - Checks action registration
|
|
31
|
+
- `quick_action_should_execute_successfully` - Tests basic action execution
|
|
32
|
+
- `quick_provider_should_provide_data` - Tests provider functionality
|
|
33
|
+
- `quick_service_should_be_available` - Tests service availability (optional)
|
|
34
|
+
- `plugin_should_integrate_with_agent_correctly` - Tests agent integration
|
|
35
|
+
- `memory_operations_should_work_with_plugin` - Tests memory system integration
|
|
36
|
+
- `plugin_should_handle_errors_gracefully` - Tests error handling
|
|
37
|
+
|
|
38
|
+
## Integration with Plugin
|
|
39
|
+
|
|
40
|
+
E2E tests are integrated directly into your plugin without the need for an intermediate export file:
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
// src/plugin.ts
|
|
44
|
+
import { QuickStarterPluginTestSuite } from './__tests__/e2e/plugin-quick-starter.e2e';
|
|
45
|
+
|
|
46
|
+
export const quickPlugin: Plugin = {
|
|
47
|
+
name: 'plugin-quick-starter',
|
|
48
|
+
// ... other properties
|
|
49
|
+
tests: [QuickStarterPluginTestSuite], // Direct import!
|
|
50
|
+
};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Running Tests
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Run all tests (component + e2e)
|
|
57
|
+
elizaos test
|
|
58
|
+
|
|
59
|
+
# Run only e2e tests (slower, full integration)
|
|
60
|
+
elizaos test --type e2e
|
|
61
|
+
|
|
62
|
+
# Run only component tests (fast, for TDD)
|
|
63
|
+
bun test
|
|
64
|
+
# or
|
|
65
|
+
elizaos test --type component
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Quick Starter Specifics
|
|
69
|
+
|
|
70
|
+
The quick starter template is designed for rapid prototyping with minimal boilerplate. Tests focus on:
|
|
71
|
+
|
|
72
|
+
1. **Basic Functionality**: Core plugin features work correctly
|
|
73
|
+
2. **Simple Integration**: Plugin integrates with the runtime
|
|
74
|
+
3. **Essential Operations**: Memory and message processing work
|
|
75
|
+
4. **Error Resilience**: Plugin handles errors gracefully
|
|
76
|
+
|
|
77
|
+
## Implementation Details
|
|
78
|
+
|
|
79
|
+
1. **Direct Import**: Tests are imported directly from the e2e test file
|
|
80
|
+
2. **Plugin Integration**: The test suite is added to the plugin's `tests` array
|
|
81
|
+
3. **Test Discovery**: The ElizaOS test runner automatically finds and executes tests
|
|
82
|
+
4. **Runtime Access**: Each test receives a real runtime instance with full access to:
|
|
83
|
+
- Plugin actions, providers, and services
|
|
84
|
+
- Agent character configuration
|
|
85
|
+
- Database and model access
|
|
86
|
+
|
|
87
|
+
## Writing New Tests
|
|
88
|
+
|
|
89
|
+
When extending the quick starter plugin, add corresponding e2e tests:
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
{
|
|
93
|
+
name: 'my_new_feature_test',
|
|
94
|
+
fn: async (runtime) => {
|
|
95
|
+
// Test your new feature
|
|
96
|
+
const feature = runtime.getFeature('my-feature');
|
|
97
|
+
if (!feature) {
|
|
98
|
+
throw new Error('My feature not loaded');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Test feature behavior
|
|
102
|
+
const result = await feature.doSomething();
|
|
103
|
+
if (!result.success) {
|
|
104
|
+
throw new Error('Feature failed: ' + result.error);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
console.log('✓ My feature works correctly');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Best Practices
|
|
113
|
+
|
|
114
|
+
1. **Keep It Simple**: Quick starter tests should remain minimal and focused
|
|
115
|
+
2. **Test Essentials**: Focus on core functionality that every plugin needs
|
|
116
|
+
3. **Clear Messages**: Use descriptive error messages for easy debugging
|
|
117
|
+
4. **Fast Feedback**: Tests should run quickly for rapid development
|
|
118
|
+
5. **Incremental Testing**: Add tests as you add features to your plugin
|
|
119
|
+
|
|
120
|
+
## Troubleshooting
|
|
121
|
+
|
|
122
|
+
### Tests not running?
|
|
123
|
+
|
|
124
|
+
- Ensure tests are exported in `plugin.ts`
|
|
125
|
+
- Check that the plugin name matches in tests
|
|
126
|
+
- Verify the ElizaOS test runner is up to date
|
|
127
|
+
|
|
128
|
+
### Tests failing?
|
|
129
|
+
|
|
130
|
+
- Check runtime initialization
|
|
131
|
+
- Verify all required services are available
|
|
132
|
+
- Ensure test data doesn't conflict with other tests
|
|
133
|
+
|
|
134
|
+
## Next Steps
|
|
135
|
+
|
|
136
|
+
1. Run the existing tests to ensure your setup works
|
|
137
|
+
2. Modify tests as you customize the plugin
|
|
138
|
+
3. Add new tests for your custom functionality
|
|
139
|
+
4. Use TDD: write tests first, then implement features
|
|
140
|
+
5. Keep tests focused and maintainable
|