@nestbox-ai/cli 1.0.19 → 1.0.21

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/test/setup.ts ADDED
@@ -0,0 +1,121 @@
1
+ import { vi } from 'vitest';
2
+
3
+ // Mock external dependencies that are commonly used across all test files
4
+
5
+ // Mock utils/error
6
+ vi.mock('../src/utils/error', () => ({
7
+ withTokenRefresh: vi.fn(),
8
+ handle401Error: vi.fn()
9
+ }));
10
+
11
+ // Mock utils/auth
12
+ vi.mock('../src/utils/auth', () => ({
13
+ getAuthToken: vi.fn().mockReturnValue({
14
+ token: 'mock-token',
15
+ serverUrl: 'http://localhost:3000'
16
+ }),
17
+ listCredentials: vi.fn(),
18
+ removeCredentials: vi.fn()
19
+ }));
20
+
21
+ // Mock @nestbox-ai/admin
22
+ vi.mock('@nestbox-ai/admin', () => ({
23
+ Configuration: vi.fn(),
24
+ AuthApi: vi.fn(),
25
+ ProjectsApi: vi.fn(),
26
+ MachineAgentApi: vi.fn(),
27
+ MachineInstancesApi: vi.fn(),
28
+ MiscellaneousApi: vi.fn(),
29
+ DocumentsApi: vi.fn(),
30
+ OAuthLoginRequestDTOTypeEnum: {}
31
+ }));
32
+
33
+ // Mock utils/project
34
+ vi.mock('../src/utils/project', () => ({
35
+ resolveProject: vi.fn()
36
+ }));
37
+
38
+ // Mock utils/agent
39
+ vi.mock('../src/utils/agent', () => ({
40
+ createNestboxConfig: vi.fn(),
41
+ createZipFromDirectory: vi.fn(),
42
+ extractZip: vi.fn(),
43
+ findProjectRoot: vi.fn(),
44
+ isTypeScriptProject: vi.fn(),
45
+ loadNestboxConfig: vi.fn(),
46
+ runPredeployScripts: vi.fn()
47
+ }));
48
+
49
+ // Mock utils/user
50
+ vi.mock('../src/utils/user', () => ({
51
+ userData: vi.fn()
52
+ }));
53
+
54
+ // Mock chalk
55
+ vi.mock('chalk', () => ({
56
+ default: {
57
+ green: vi.fn((text) => text),
58
+ red: vi.fn((text) => text),
59
+ yellow: vi.fn((text) => text),
60
+ blue: vi.fn((text) => text)
61
+ }
62
+ }));
63
+
64
+ // Mock ora
65
+ vi.mock('ora', () => ({
66
+ default: vi.fn(() => ({
67
+ start: vi.fn().mockReturnThis(),
68
+ succeed: vi.fn().mockReturnThis(),
69
+ fail: vi.fn().mockReturnThis(),
70
+ text: ''
71
+ }))
72
+ }));
73
+
74
+ // Mock cli-table3
75
+ vi.mock('cli-table3', () => ({
76
+ default: vi.fn()
77
+ }));
78
+
79
+ // Mock inquirer
80
+ vi.mock('inquirer', () => ({
81
+ default: {
82
+ prompt: vi.fn()
83
+ }
84
+ }));
85
+
86
+ // Mock fs
87
+ vi.mock('fs', () => ({
88
+ default: {
89
+ existsSync: vi.fn(),
90
+ readFileSync: vi.fn(),
91
+ writeFileSync: vi.fn()
92
+ }
93
+ }));
94
+
95
+ // Mock yaml
96
+ vi.mock('yaml', () => ({
97
+ default: {
98
+ load: vi.fn()
99
+ }
100
+ }));
101
+
102
+ // Mock axios
103
+ vi.mock('axios', () => ({
104
+ default: {
105
+ get: vi.fn(),
106
+ post: vi.fn()
107
+ }
108
+ }));
109
+
110
+ // Mock open
111
+ vi.mock('open', () => ({
112
+ default: vi.fn()
113
+ }));
114
+
115
+ // Mock path
116
+ vi.mock('path', () => ({
117
+ default: {
118
+ join: vi.fn(),
119
+ resolve: vi.fn()
120
+ }
121
+ }));
package/tsconfig.json CHANGED
@@ -112,5 +112,7 @@
112
112
  "declaration": true,
113
113
  "sourceMap": true,
114
114
  "resolveJsonModule": true
115
- }
115
+ },
116
+ "include": ["src/**/*"],
117
+ "exclude": ["node_modules", "dist", "test", "**/*.test.ts", "**/*.spec.ts", "vitest.config.ts"]
116
118
  }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vite").UserConfig;
2
+ export default _default;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config_1 = require("vitest/config");
4
+ exports.default = (0, config_1.defineConfig)({
5
+ test: {
6
+ environment: 'node',
7
+ globals: true,
8
+ setupFiles: ['./test/setup.ts'],
9
+ coverage: {
10
+ provider: 'v8',
11
+ reporter: ['text', 'json', 'html'],
12
+ exclude: [
13
+ 'node_modules/',
14
+ 'dist/',
15
+ 'templates/',
16
+ 'test/',
17
+ '**/*.test.ts',
18
+ '**/*.spec.ts'
19
+ ]
20
+ }
21
+ }
22
+ });
23
+ //# sourceMappingURL=vitest.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vitest.config.js","sourceRoot":"","sources":["vitest.config.ts"],"names":[],"mappings":";;AAAA,0CAA4C;AAE5C,kBAAe,IAAA,qBAAY,EAAC;IAC1B,IAAI,EAAE;QACJ,WAAW,EAAE,MAAM;QACnB,OAAO,EAAE,IAAI;QACb,UAAU,EAAE,CAAC,iBAAiB,CAAC;QAC/B,QAAQ,EAAE;YACR,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;YAClC,OAAO,EAAE;gBACP,eAAe;gBACf,OAAO;gBACP,YAAY;gBACZ,OAAO;gBACP,cAAc;gBACd,cAAc;aACf;SACF;KACF;CACF,CAAC,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { defineConfig } from 'vitest/config'
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ environment: 'node',
6
+ globals: true,
7
+ setupFiles: ['./test/setup.ts'],
8
+ coverage: {
9
+ provider: 'v8',
10
+ reporter: ['text', 'json', 'html'],
11
+ exclude: [
12
+ 'node_modules/',
13
+ 'dist/',
14
+ 'templates/',
15
+ 'test/',
16
+ '**/*.test.ts',
17
+ '**/*.spec.ts'
18
+ ]
19
+ }
20
+ }
21
+ })