@inkeep/create-agents 0.0.0-dev-20251217021908 → 0.0.0-dev-20251217091232
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/dist/__tests__/utils.test.js +20 -14
- package/package.json +2 -2
|
@@ -3,12 +3,26 @@ import fs from 'fs-extra';
|
|
|
3
3
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
4
|
import { cloneTemplate, cloneTemplateLocal, getAvailableTemplates } from '../templates';
|
|
5
5
|
import { createAgents } from '../utils';
|
|
6
|
+
// Create the mock execAsync function that will be used by promisify - hoisted so it's available in mocks
|
|
7
|
+
const { mockExecAsync } = vi.hoisted(() => ({
|
|
8
|
+
mockExecAsync: vi.fn().mockResolvedValue({ stdout: '', stderr: '' }),
|
|
9
|
+
}));
|
|
6
10
|
// Mock all dependencies
|
|
7
11
|
vi.mock('fs-extra');
|
|
8
12
|
vi.mock('../templates');
|
|
9
13
|
vi.mock('@clack/prompts');
|
|
10
|
-
vi.mock('child_process')
|
|
11
|
-
vi.
|
|
14
|
+
vi.mock('node:child_process', () => ({
|
|
15
|
+
exec: vi.fn(),
|
|
16
|
+
spawn: vi.fn(() => ({
|
|
17
|
+
pid: 12345,
|
|
18
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
19
|
+
on: vi.fn(),
|
|
20
|
+
kill: vi.fn(),
|
|
21
|
+
})),
|
|
22
|
+
}));
|
|
23
|
+
vi.mock('node:util', () => ({
|
|
24
|
+
promisify: vi.fn(() => mockExecAsync),
|
|
25
|
+
}));
|
|
12
26
|
// Setup default mocks
|
|
13
27
|
const mockSpinner = {
|
|
14
28
|
start: vi.fn().mockReturnThis(),
|
|
@@ -20,6 +34,8 @@ describe('createAgents - Template and Project ID Logic', () => {
|
|
|
20
34
|
let processChdirSpy;
|
|
21
35
|
beforeEach(() => {
|
|
22
36
|
vi.clearAllMocks();
|
|
37
|
+
// Reset the mockExecAsync to default behavior
|
|
38
|
+
mockExecAsync.mockResolvedValue({ stdout: '', stderr: '' });
|
|
23
39
|
// Mock process methods
|
|
24
40
|
processExitSpy = vi.spyOn(process, 'exit').mockImplementation((code) => {
|
|
25
41
|
// Only throw for exit(0) which is expected behavior in some tests
|
|
@@ -58,18 +74,6 @@ describe('createAgents - Template and Project ID Logic', () => {
|
|
|
58
74
|
]);
|
|
59
75
|
vi.mocked(cloneTemplate).mockResolvedValue(undefined);
|
|
60
76
|
vi.mocked(cloneTemplateLocal).mockResolvedValue(undefined);
|
|
61
|
-
// Mock util.promisify to return a mock exec function
|
|
62
|
-
const mockExecAsync = vi.fn().mockResolvedValue({ stdout: '', stderr: '' });
|
|
63
|
-
const util = require('node:util');
|
|
64
|
-
util.promisify = vi.fn(() => mockExecAsync);
|
|
65
|
-
// Mock child_process.spawn
|
|
66
|
-
const childProcess = require('node:child_process');
|
|
67
|
-
childProcess.spawn = vi.fn(() => ({
|
|
68
|
-
pid: 12345,
|
|
69
|
-
stdio: ['pipe', 'pipe', 'pipe'],
|
|
70
|
-
on: vi.fn(),
|
|
71
|
-
kill: vi.fn(),
|
|
72
|
-
}));
|
|
73
77
|
});
|
|
74
78
|
afterEach(() => {
|
|
75
79
|
processExitSpy.mockRestore();
|
|
@@ -334,4 +338,6 @@ function setupDefaultMocks() {
|
|
|
334
338
|
vi.mocked(getAvailableTemplates).mockResolvedValue(['event-planner', 'chatbot', 'data-analysis']);
|
|
335
339
|
vi.mocked(cloneTemplate).mockResolvedValue(undefined);
|
|
336
340
|
vi.mocked(cloneTemplateLocal).mockResolvedValue(undefined);
|
|
341
|
+
// Reset mockExecAsync for tests that clear mocks
|
|
342
|
+
mockExecAsync.mockResolvedValue({ stdout: '', stderr: '' });
|
|
337
343
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/create-agents",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20251217091232",
|
|
4
4
|
"description": "Create an Inkeep Agent Framework project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"drizzle-kit": "^0.31.5",
|
|
35
35
|
"fs-extra": "^11.0.0",
|
|
36
36
|
"picocolors": "^1.0.0",
|
|
37
|
-
"@inkeep/agents-core": "0.0.0-dev-
|
|
37
|
+
"@inkeep/agents-core": "0.0.0-dev-20251217091232"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/degit": "^2.8.6",
|