@simplysm/sd-cli 13.0.75 → 13.0.77
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 +341 -16
- package/dist/builders/DtsBuilder.js +2 -2
- package/dist/builders/DtsBuilder.js.map +1 -1
- package/dist/builders/LibraryBuilder.d.ts +3 -3
- package/dist/builders/LibraryBuilder.d.ts.map +1 -1
- package/dist/builders/LibraryBuilder.js +2 -2
- package/dist/builders/LibraryBuilder.js.map +1 -1
- package/dist/builders/types.d.ts +7 -1
- package/dist/builders/types.d.ts.map +1 -1
- package/dist/capacitor/capacitor.d.ts +5 -0
- package/dist/capacitor/capacitor.d.ts.map +1 -1
- package/dist/capacitor/capacitor.js +59 -59
- package/dist/capacitor/capacitor.js.map +1 -1
- package/dist/commands/check.js +4 -4
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/device.js +3 -3
- package/dist/commands/device.js.map +1 -1
- package/dist/commands/lint.d.ts +2 -2
- package/dist/commands/lint.d.ts.map +1 -1
- package/dist/commands/lint.js +4 -98
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/publish.js +20 -20
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/replace-deps.js +1 -1
- package/dist/commands/replace-deps.js.map +1 -1
- package/dist/commands/typecheck.js +9 -9
- package/dist/commands/typecheck.js.map +1 -1
- package/dist/electron/electron.js +16 -16
- package/dist/electron/electron.js.map +1 -1
- package/dist/orchestrators/BuildOrchestrator.js +6 -6
- package/dist/orchestrators/BuildOrchestrator.js.map +1 -1
- package/dist/orchestrators/DevOrchestrator.d.ts +7 -6
- package/dist/orchestrators/DevOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/DevOrchestrator.js +157 -203
- package/dist/orchestrators/DevOrchestrator.js.map +1 -1
- package/dist/orchestrators/WatchOrchestrator.d.ts.map +1 -1
- package/dist/orchestrators/WatchOrchestrator.js +3 -4
- package/dist/orchestrators/WatchOrchestrator.js.map +1 -1
- package/dist/sd-cli.js +1 -1
- package/dist/sd-cli.js.map +1 -1
- package/dist/sd-config.types.d.ts +9 -3
- package/dist/sd-config.types.d.ts.map +1 -1
- package/dist/utils/copy-public.d.ts.map +1 -1
- package/dist/utils/copy-public.js +23 -27
- package/dist/utils/copy-public.js.map +1 -1
- package/dist/utils/copy-src.d.ts.map +1 -1
- package/dist/utils/copy-src.js +7 -7
- package/dist/utils/copy-src.js.map +1 -1
- package/dist/utils/esbuild-config.d.ts.map +1 -1
- package/dist/utils/esbuild-config.js +36 -42
- package/dist/utils/esbuild-config.js.map +1 -1
- package/dist/utils/replace-deps.js +7 -7
- package/dist/utils/replace-deps.js.map +1 -1
- package/dist/utils/sd-config.js +2 -2
- package/dist/utils/sd-config.js.map +1 -1
- package/dist/utils/template.js +7 -7
- package/dist/utils/template.js.map +1 -1
- package/dist/utils/tsconfig.d.ts +1 -2
- package/dist/utils/tsconfig.d.ts.map +1 -1
- package/dist/utils/tsconfig.js +5 -8
- package/dist/utils/tsconfig.js.map +1 -1
- package/dist/utils/typecheck-serialization.js +2 -2
- package/dist/utils/typecheck-serialization.js.map +1 -1
- package/dist/utils/vite-config.d.ts +2 -0
- package/dist/utils/vite-config.d.ts.map +1 -1
- package/dist/utils/vite-config.js +36 -3
- package/dist/utils/vite-config.js.map +1 -1
- package/dist/utils/worker-events.d.ts +11 -1
- package/dist/utils/worker-events.d.ts.map +1 -1
- package/dist/utils/worker-events.js +3 -5
- package/dist/utils/worker-events.js.map +1 -1
- package/dist/utils/worker-utils.d.ts +2 -2
- package/dist/utils/worker-utils.d.ts.map +1 -1
- package/dist/utils/worker-utils.js +1 -1
- package/dist/utils/worker-utils.js.map +1 -1
- package/dist/workers/client.worker.d.ts +1 -1
- package/dist/workers/client.worker.js +3 -3
- package/dist/workers/client.worker.js.map +1 -1
- package/dist/workers/dts.worker.d.ts +1 -1
- package/dist/workers/dts.worker.d.ts.map +1 -1
- package/dist/workers/dts.worker.js +13 -28
- package/dist/workers/dts.worker.js.map +1 -1
- package/dist/workers/library.worker.d.ts +1 -1
- package/dist/workers/library.worker.js +4 -4
- package/dist/workers/library.worker.js.map +1 -1
- package/dist/workers/lint.worker.d.ts +1 -1
- package/dist/workers/server-runtime.worker.d.ts +1 -1
- package/dist/workers/server-runtime.worker.js +4 -4
- package/dist/workers/server-runtime.worker.js.map +1 -1
- package/dist/workers/server.worker.d.ts +1 -1
- package/dist/workers/server.worker.js +6 -6
- package/dist/workers/server.worker.js.map +1 -1
- package/package.json +4 -5
- package/src/builders/DtsBuilder.ts +2 -2
- package/src/builders/LibraryBuilder.ts +7 -10
- package/src/builders/types.ts +6 -1
- package/src/capacitor/capacitor.ts +61 -60
- package/src/commands/check.ts +4 -4
- package/src/commands/device.ts +3 -3
- package/src/commands/lint.ts +6 -117
- package/src/commands/publish.ts +20 -20
- package/src/commands/replace-deps.ts +1 -1
- package/src/commands/typecheck.ts +9 -9
- package/src/electron/electron.ts +16 -16
- package/src/orchestrators/BuildOrchestrator.ts +6 -6
- package/src/orchestrators/DevOrchestrator.ts +210 -256
- package/src/orchestrators/WatchOrchestrator.ts +8 -10
- package/src/sd-cli.ts +1 -1
- package/src/sd-config.types.ts +10 -3
- package/src/utils/copy-public.ts +22 -26
- package/src/utils/copy-src.ts +7 -7
- package/src/utils/esbuild-config.ts +51 -63
- package/src/utils/replace-deps.ts +7 -7
- package/src/utils/sd-config.ts +2 -2
- package/src/utils/template.ts +7 -7
- package/src/utils/tsconfig.ts +6 -10
- package/src/utils/typecheck-serialization.ts +2 -2
- package/src/utils/vite-config.ts +376 -341
- package/src/utils/worker-events.ts +13 -10
- package/src/utils/worker-utils.ts +45 -45
- package/src/workers/client.worker.ts +3 -3
- package/src/workers/dts.worker.ts +451 -467
- package/src/workers/library.worker.ts +4 -4
- package/src/workers/server-runtime.worker.ts +4 -4
- package/src/workers/server.worker.ts +572 -572
- package/templates/init/package.json.hbs +2 -3
- package/templates/init/packages/client-admin/package.json.hbs +5 -5
- package/templates/init/packages/client-admin/src/views/auth/LoginView.tsx +2 -2
- package/templates/init/packages/client-admin/src/views/home/base/employee/EmployeeDetail.tsx.hbs +86 -105
- package/templates/init/packages/client-admin/src/views/home/base/employee/EmployeeSheet.tsx.hbs +1 -1
- package/templates/init/packages/client-admin/src/views/home/base/role-permission/RoleDetail.tsx.hbs +4 -12
- package/templates/init/packages/client-admin/src/views/home/base/role-permission/RolePermissionDetail.tsx.hbs +0 -2
- package/templates/init/packages/client-admin/src/views/home/base/role-permission/RolePermissionView.tsx +1 -1
- package/templates/init/packages/client-admin/src/views/home/base/role-permission/RoleSheet.tsx.hbs +1 -1
- package/templates/init/packages/client-admin/src/views/home/my-info/MyInfoDetail.tsx.hbs +36 -43
- package/templates/init/packages/db-main/package.json.hbs +2 -2
- package/templates/init/packages/server/package.json.hbs +4 -4
- package/templates/init/tests/e2e/package.json.hbs +1 -1
- package/tests/get-compiler-options-for-package.spec.ts +13 -72
- package/tests/get-package-source-files.spec.ts +0 -42
- package/tests/get-types-from-package-json.spec.ts +15 -30
- package/tests/infra/ResultCollector.spec.ts +0 -9
- package/tests/infra/WorkerManager.spec.ts +0 -34
- package/tests/load-ignore-patterns.spec.ts +15 -40
- package/tests/load-sd-config.spec.ts +16 -53
- package/tests/publish-config-narrowing.spec.ts +20 -0
- package/tests/run-lint.spec.ts +38 -87
- package/tests/run-typecheck.spec.ts +194 -303
- package/tests/run-watch.spec.ts +0 -34
- package/tests/sd-cli.spec.ts +0 -88
- package/tests/sd-public-dev-plugin-mime.spec.ts +19 -0
- package/dist/builders/index.d.ts +0 -5
- package/dist/builders/index.d.ts.map +0 -1
- package/dist/builders/index.js +0 -5
- package/dist/builders/index.js.map +0 -6
- package/dist/infra/index.d.ts +0 -4
- package/dist/infra/index.d.ts.map +0 -1
- package/dist/infra/index.js +0 -4
- package/dist/infra/index.js.map +0 -6
- package/dist/orchestrators/index.d.ts +0 -4
- package/dist/orchestrators/index.d.ts.map +0 -1
- package/dist/orchestrators/index.js +0 -4
- package/dist/orchestrators/index.js.map +0 -6
- package/src/builders/index.ts +0 -4
- package/src/infra/index.ts +0 -3
- package/src/orchestrators/index.ts +0 -3
- package/templates/init/stylelint.config.ts +0 -1
package/tests/run-lint.spec.ts
CHANGED
|
@@ -40,19 +40,23 @@ vi.mock("@simplysm/core-node", () => {
|
|
|
40
40
|
return child.startsWith(parentWithSlash);
|
|
41
41
|
};
|
|
42
42
|
return {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
fsx: {
|
|
44
|
+
exists: vi.fn(),
|
|
45
|
+
glob: vi.fn(),
|
|
46
|
+
},
|
|
47
|
+
pathx: {
|
|
48
|
+
posix: vi.fn(posix),
|
|
49
|
+
isChildPath: vi.fn(isChildPath),
|
|
50
|
+
filterByTargets: vi.fn((files: string[], targets: string[], cwd: string) => {
|
|
51
|
+
if (targets.length === 0) return files;
|
|
52
|
+
return files.filter((file) => {
|
|
53
|
+
const relativePath = posix(file.replace(cwd + "/", ""));
|
|
54
|
+
return targets.some(
|
|
55
|
+
(target) => relativePath === target || isChildPath(relativePath, target),
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
}),
|
|
59
|
+
},
|
|
56
60
|
};
|
|
57
61
|
});
|
|
58
62
|
|
|
@@ -81,7 +85,7 @@ vi.mock("consola", () => {
|
|
|
81
85
|
};
|
|
82
86
|
});
|
|
83
87
|
|
|
84
|
-
import {
|
|
88
|
+
import { fsx } from "@simplysm/core-node";
|
|
85
89
|
import { runLint, executeLint } from "../src/commands/lint";
|
|
86
90
|
|
|
87
91
|
describe("runLint", () => {
|
|
@@ -108,7 +112,7 @@ describe("runLint", () => {
|
|
|
108
112
|
|
|
109
113
|
it("sets exitCode to 1 when lint errors occur", async () => {
|
|
110
114
|
const cwd = "/project";
|
|
111
|
-
vi.mocked(
|
|
115
|
+
vi.mocked(fsx.exists).mockImplementation((filePath: string) => {
|
|
112
116
|
return Promise.resolve(filePath === path.join(cwd, "eslint.config.ts"));
|
|
113
117
|
});
|
|
114
118
|
|
|
@@ -116,7 +120,7 @@ describe("runLint", () => {
|
|
|
116
120
|
default: [{ ignores: ["node_modules/**"] }],
|
|
117
121
|
});
|
|
118
122
|
|
|
119
|
-
vi.mocked(
|
|
123
|
+
vi.mocked(fsx.glob).mockResolvedValue(["/project/src/index.ts"]);
|
|
120
124
|
|
|
121
125
|
mockState.lintResults = [{ errorCount: 2, warningCount: 0 }];
|
|
122
126
|
|
|
@@ -127,7 +131,7 @@ describe("runLint", () => {
|
|
|
127
131
|
|
|
128
132
|
it("does not set exitCode when no lint errors", async () => {
|
|
129
133
|
const cwd = "/project";
|
|
130
|
-
vi.mocked(
|
|
134
|
+
vi.mocked(fsx.exists).mockImplementation((filePath: string) => {
|
|
131
135
|
return Promise.resolve(filePath === path.join(cwd, "eslint.config.ts"));
|
|
132
136
|
});
|
|
133
137
|
|
|
@@ -135,7 +139,7 @@ describe("runLint", () => {
|
|
|
135
139
|
default: [{ ignores: ["node_modules/**"] }],
|
|
136
140
|
});
|
|
137
141
|
|
|
138
|
-
vi.mocked(
|
|
142
|
+
vi.mocked(fsx.glob).mockResolvedValue(["/project/src/index.ts"]);
|
|
139
143
|
|
|
140
144
|
mockState.lintResults = [{ errorCount: 0, warningCount: 0 }];
|
|
141
145
|
|
|
@@ -146,7 +150,7 @@ describe("runLint", () => {
|
|
|
146
150
|
|
|
147
151
|
it("filters files using targets option", async () => {
|
|
148
152
|
const cwd = "/project";
|
|
149
|
-
vi.mocked(
|
|
153
|
+
vi.mocked(fsx.exists).mockImplementation((filePath: string) => {
|
|
150
154
|
return Promise.resolve(filePath === path.join(cwd, "eslint.config.ts"));
|
|
151
155
|
});
|
|
152
156
|
|
|
@@ -154,7 +158,7 @@ describe("runLint", () => {
|
|
|
154
158
|
default: [{ ignores: ["node_modules/**"] }],
|
|
155
159
|
});
|
|
156
160
|
|
|
157
|
-
vi.mocked(
|
|
161
|
+
vi.mocked(fsx.glob).mockResolvedValue([
|
|
158
162
|
"/project/packages/core-common/src/index.ts",
|
|
159
163
|
"/project/packages/core-node/src/index.ts",
|
|
160
164
|
"/project/packages/cli/src/index.ts",
|
|
@@ -174,7 +178,7 @@ describe("runLint", () => {
|
|
|
174
178
|
|
|
175
179
|
it("filters files from all paths when multiple targets specified", async () => {
|
|
176
180
|
const cwd = "/project";
|
|
177
|
-
vi.mocked(
|
|
181
|
+
vi.mocked(fsx.exists).mockImplementation((filePath: string) => {
|
|
178
182
|
return Promise.resolve(filePath === path.join(cwd, "eslint.config.ts"));
|
|
179
183
|
});
|
|
180
184
|
|
|
@@ -182,7 +186,7 @@ describe("runLint", () => {
|
|
|
182
186
|
default: [{ ignores: ["node_modules/**"] }],
|
|
183
187
|
});
|
|
184
188
|
|
|
185
|
-
vi.mocked(
|
|
189
|
+
vi.mocked(fsx.glob).mockResolvedValue([
|
|
186
190
|
"/project/packages/core-common/src/index.ts",
|
|
187
191
|
"/project/packages/core-node/src/index.ts",
|
|
188
192
|
"/project/packages/cli/src/index.ts",
|
|
@@ -206,7 +210,7 @@ describe("runLint", () => {
|
|
|
206
210
|
|
|
207
211
|
it("calls ESLint.outputFixes when fix option is enabled", async () => {
|
|
208
212
|
const cwd = "/project";
|
|
209
|
-
vi.mocked(
|
|
213
|
+
vi.mocked(fsx.exists).mockImplementation((filePath: string) => {
|
|
210
214
|
return Promise.resolve(filePath === path.join(cwd, "eslint.config.ts"));
|
|
211
215
|
});
|
|
212
216
|
|
|
@@ -214,7 +218,7 @@ describe("runLint", () => {
|
|
|
214
218
|
default: [{ ignores: ["node_modules/**"] }],
|
|
215
219
|
});
|
|
216
220
|
|
|
217
|
-
vi.mocked(
|
|
221
|
+
vi.mocked(fsx.glob).mockResolvedValue(["/project/src/index.ts"]);
|
|
218
222
|
|
|
219
223
|
mockState.lintResults = [{ errorCount: 0, warningCount: 0 }];
|
|
220
224
|
|
|
@@ -225,7 +229,7 @@ describe("runLint", () => {
|
|
|
225
229
|
|
|
226
230
|
it("exits early when no files to lint", async () => {
|
|
227
231
|
const cwd = "/project";
|
|
228
|
-
vi.mocked(
|
|
232
|
+
vi.mocked(fsx.exists).mockImplementation((filePath: string) => {
|
|
229
233
|
return Promise.resolve(filePath === path.join(cwd, "eslint.config.ts"));
|
|
230
234
|
});
|
|
231
235
|
|
|
@@ -233,7 +237,7 @@ describe("runLint", () => {
|
|
|
233
237
|
default: [{ ignores: ["node_modules/**"] }],
|
|
234
238
|
});
|
|
235
239
|
|
|
236
|
-
vi.mocked(
|
|
240
|
+
vi.mocked(fsx.glob).mockResolvedValue([]);
|
|
237
241
|
|
|
238
242
|
await runLint({ targets: [], fix: false, timing: false });
|
|
239
243
|
|
|
@@ -244,7 +248,7 @@ describe("runLint", () => {
|
|
|
244
248
|
|
|
245
249
|
it("throws error when ESLint config file is not found", async () => {
|
|
246
250
|
// When all config files are missing
|
|
247
|
-
vi.mocked(
|
|
251
|
+
vi.mocked(fsx.exists).mockResolvedValue(false);
|
|
248
252
|
|
|
249
253
|
await expect(runLint({ targets: [], fix: false, timing: false })).rejects.toThrow(
|
|
250
254
|
"Cannot find ESLint config file",
|
|
@@ -255,28 +259,9 @@ describe("runLint", () => {
|
|
|
255
259
|
expect(mockState.lintedFiles).toHaveLength(0);
|
|
256
260
|
});
|
|
257
261
|
|
|
258
|
-
it("does not set exitCode when only warnings exist", async () => {
|
|
259
|
-
const cwd = "/project";
|
|
260
|
-
vi.mocked(fsExists).mockImplementation((filePath: string) => {
|
|
261
|
-
return Promise.resolve(filePath === path.join(cwd, "eslint.config.ts"));
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
mockJitiImportFn.mockResolvedValue({
|
|
265
|
-
default: [{ ignores: ["node_modules/**"] }],
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
vi.mocked(fsGlob).mockResolvedValue(["/project/src/index.ts"]);
|
|
269
|
-
|
|
270
|
-
mockState.lintResults = [{ errorCount: 0, warningCount: 3 }];
|
|
271
|
-
|
|
272
|
-
await runLint({ targets: [], fix: false, timing: false });
|
|
273
|
-
|
|
274
|
-
expect(process.exitCode).toBeUndefined();
|
|
275
|
-
});
|
|
276
|
-
|
|
277
262
|
it("sets TIMING environment variable when timing option is enabled", async () => {
|
|
278
263
|
const cwd = "/project";
|
|
279
|
-
vi.mocked(
|
|
264
|
+
vi.mocked(fsx.exists).mockImplementation((filePath: string) => {
|
|
280
265
|
return Promise.resolve(filePath === path.join(cwd, "eslint.config.ts"));
|
|
281
266
|
});
|
|
282
267
|
|
|
@@ -284,7 +269,7 @@ describe("runLint", () => {
|
|
|
284
269
|
default: [{ ignores: ["node_modules/**"] }],
|
|
285
270
|
});
|
|
286
271
|
|
|
287
|
-
vi.mocked(
|
|
272
|
+
vi.mocked(fsx.glob).mockResolvedValue(["/project/src/index.ts"]);
|
|
288
273
|
|
|
289
274
|
mockState.lintResults = [{ errorCount: 0, warningCount: 0 }];
|
|
290
275
|
|
|
@@ -306,7 +291,7 @@ describe("runLint", () => {
|
|
|
306
291
|
|
|
307
292
|
it("uses eslint.config.mts when eslint.config.ts is not found", async () => {
|
|
308
293
|
const cwd = "/project";
|
|
309
|
-
vi.mocked(
|
|
294
|
+
vi.mocked(fsx.exists).mockImplementation((filePath: string) => {
|
|
310
295
|
// eslint.config.ts does not exist, only eslint.config.mts
|
|
311
296
|
return Promise.resolve(filePath === path.join(cwd, "eslint.config.mts"));
|
|
312
297
|
});
|
|
@@ -315,7 +300,7 @@ describe("runLint", () => {
|
|
|
315
300
|
default: [{ ignores: ["dist/**"] }],
|
|
316
301
|
});
|
|
317
302
|
|
|
318
|
-
vi.mocked(
|
|
303
|
+
vi.mocked(fsx.glob).mockResolvedValue(["/project/src/index.ts"]);
|
|
319
304
|
|
|
320
305
|
mockState.lintResults = [{ errorCount: 0, warningCount: 0 }];
|
|
321
306
|
|
|
@@ -326,20 +311,6 @@ describe("runLint", () => {
|
|
|
326
311
|
expect(process.exitCode).toBeUndefined();
|
|
327
312
|
});
|
|
328
313
|
|
|
329
|
-
it("propagates error when glob fails", async () => {
|
|
330
|
-
const cwd = "/project";
|
|
331
|
-
vi.mocked(fsExists).mockImplementation((filePath: string) => {
|
|
332
|
-
return Promise.resolve(filePath === path.join(cwd, "eslint.config.ts"));
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
mockJitiImportFn.mockResolvedValue({
|
|
336
|
-
default: [{ ignores: ["node_modules/**"] }],
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
vi.mocked(fsGlob).mockRejectedValue(new Error("Glob error"));
|
|
340
|
-
|
|
341
|
-
await expect(runLint({ targets: [], fix: false, timing: false })).rejects.toThrow("Glob error");
|
|
342
|
-
});
|
|
343
314
|
});
|
|
344
315
|
|
|
345
316
|
describe("executeLint", () => {
|
|
@@ -357,7 +328,7 @@ describe("executeLint", () => {
|
|
|
357
328
|
|
|
358
329
|
// Default ESLint config mock
|
|
359
330
|
const cwd = "/project";
|
|
360
|
-
vi.mocked(
|
|
331
|
+
vi.mocked(fsx.exists).mockImplementation((filePath: string) => {
|
|
361
332
|
return Promise.resolve(filePath === path.join(cwd, "eslint.config.ts"));
|
|
362
333
|
});
|
|
363
334
|
mockJitiImportFn.mockResolvedValue({
|
|
@@ -372,7 +343,7 @@ describe("executeLint", () => {
|
|
|
372
343
|
|
|
373
344
|
it("returns success result when no errors", async () => {
|
|
374
345
|
mockState.lintResults = [{ errorCount: 0, warningCount: 0 }];
|
|
375
|
-
vi.mocked(
|
|
346
|
+
vi.mocked(fsx.glob).mockResolvedValue(["/project/packages/core-common/src/index.ts"]);
|
|
376
347
|
|
|
377
348
|
const result = await executeLint({ targets: [], fix: false, timing: false });
|
|
378
349
|
|
|
@@ -383,7 +354,7 @@ describe("executeLint", () => {
|
|
|
383
354
|
|
|
384
355
|
it("returns failure result when errors exist", async () => {
|
|
385
356
|
mockState.lintResults = [{ errorCount: 2, warningCount: 1 }];
|
|
386
|
-
vi.mocked(
|
|
357
|
+
vi.mocked(fsx.glob).mockResolvedValue(["/project/packages/core-common/src/index.ts"]);
|
|
387
358
|
|
|
388
359
|
const result = await executeLint({ targets: [], fix: false, timing: false });
|
|
389
360
|
|
|
@@ -392,24 +363,4 @@ describe("executeLint", () => {
|
|
|
392
363
|
expect(result.warningCount).toBe(1);
|
|
393
364
|
});
|
|
394
365
|
|
|
395
|
-
it("includes formatter output in formattedOutput", async () => {
|
|
396
|
-
mockState.lintResults = [{ errorCount: 1, warningCount: 0 }];
|
|
397
|
-
vi.mocked(fsGlob).mockResolvedValue(["/project/packages/core-common/src/index.ts"]);
|
|
398
|
-
|
|
399
|
-
const result = await executeLint({ targets: [], fix: false, timing: false });
|
|
400
|
-
|
|
401
|
-
// MockESLint's formatter returns empty string, so formattedOutput is also empty string
|
|
402
|
-
expect(result.formattedOutput).toBeDefined();
|
|
403
|
-
expect(typeof result.formattedOutput).toBe("string");
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
it("returns success result when no files exist", async () => {
|
|
407
|
-
vi.mocked(fsGlob).mockResolvedValue([]);
|
|
408
|
-
|
|
409
|
-
const result = await executeLint({ targets: [], fix: false, timing: false });
|
|
410
|
-
|
|
411
|
-
expect(result.success).toBe(true);
|
|
412
|
-
expect(result.errorCount).toBe(0);
|
|
413
|
-
expect(result.warningCount).toBe(0);
|
|
414
|
-
});
|
|
415
366
|
});
|