@revstackhq/cli 0.0.0-dev-20260226064743 → 0.0.0-dev-20260227092523

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.
@@ -89,22 +89,32 @@ describe("init command", () => {
89
89
  expect.stringContaining("revstack"),
90
90
  { recursive: true },
91
91
  );
92
- expect(mockFs.writeFileSync).toHaveBeenCalledTimes(3);
92
+ expect(mockFs.writeFileSync).toHaveBeenCalledTimes(5);
93
93
  expect(mockFs.writeFileSync).toHaveBeenCalledWith(
94
94
  expect.stringContaining("features.ts"),
95
95
  expect.stringContaining("defineFeature"),
96
96
  "utf-8",
97
97
  );
98
+ expect(mockFs.writeFileSync).toHaveBeenCalledWith(
99
+ expect.stringContaining("addons.ts"),
100
+ expect.stringContaining("defineAddon"),
101
+ "utf-8",
102
+ );
98
103
  expect(mockFs.writeFileSync).toHaveBeenCalledWith(
99
104
  expect.stringContaining("plans.ts"),
100
105
  expect.stringContaining("definePlan"),
101
106
  "utf-8",
102
107
  );
103
108
  expect(mockFs.writeFileSync).toHaveBeenCalledWith(
104
- expect.stringContaining("revstack.config.ts"),
109
+ expect.stringContaining("index.ts"),
105
110
  expect.stringContaining("defineConfig"),
106
111
  "utf-8",
107
112
  );
113
+ expect(mockFs.writeFileSync).toHaveBeenCalledWith(
114
+ expect.stringContaining("revstack.config.ts"),
115
+ expect.stringContaining("import config from"),
116
+ "utf-8",
117
+ );
108
118
  expect(consoleSpy).toHaveBeenCalledWith(
109
119
  expect.stringContaining("Created revstack config structure"),
110
120
  );
@@ -16,6 +16,22 @@ vi.mock("prompts", () => ({
16
16
  default: vi.fn(),
17
17
  }));
18
18
 
19
+ // ── Mock @revstackhq/core ────────────────────────────────────
20
+ vi.mock("@revstackhq/core", () => {
21
+ class RevstackValidationError extends Error {
22
+ errors: string[];
23
+ constructor(errors: string[]) {
24
+ super("Validation failed");
25
+ this.name = "RevstackValidationError";
26
+ this.errors = errors;
27
+ }
28
+ }
29
+ return {
30
+ validateConfig: vi.fn(),
31
+ RevstackValidationError,
32
+ };
33
+ });
34
+
19
35
  // ── Mock ora ─────────────────────────────────────────────────
20
36
  const mockSpinner = {
21
37
  start: vi.fn().mockReturnThis(),
@@ -129,7 +145,7 @@ describe("push command", () => {
129
145
  const program = createTestProgram();
130
146
 
131
147
  await expect(
132
- program.parseAsync(["node", "revstack", "push"], { from: "node" })
148
+ program.parseAsync(["node", "revstack", "push"], { from: "node" }),
133
149
  ).rejects.toThrow(ProcessExitError);
134
150
 
135
151
  expect(exitSpy).toHaveBeenCalledWith(1);
@@ -139,7 +155,7 @@ describe("push command", () => {
139
155
  it("diffs, confirms, and pushes successfully", async () => {
140
156
  mockGetApiKey.mockReturnValue("sk_test_valid123");
141
157
  mockLoadLocalConfig.mockResolvedValue(
142
- SAMPLE_CONFIG as Record<string, unknown>
158
+ SAMPLE_CONFIG as Record<string, unknown>,
143
159
  );
144
160
 
145
161
  const diffResponse = {
@@ -169,7 +185,7 @@ describe("push command", () => {
169
185
  it("exits early when push is blocked (canPush: false)", async () => {
170
186
  mockGetApiKey.mockReturnValue("sk_test_valid123");
171
187
  mockLoadLocalConfig.mockResolvedValue(
172
- SAMPLE_CONFIG as Record<string, unknown>
188
+ SAMPLE_CONFIG as Record<string, unknown>,
173
189
  );
174
190
 
175
191
  const diffResponse = {
@@ -194,7 +210,7 @@ describe("push command", () => {
194
210
  const program = createTestProgram();
195
211
 
196
212
  await expect(
197
- program.parseAsync(["node", "revstack", "push"], { from: "node" })
213
+ program.parseAsync(["node", "revstack", "push"], { from: "node" }),
198
214
  ).rejects.toThrow(ProcessExitError);
199
215
 
200
216
  // Only diff called, push never reached