kanban-ai 0.20.0 → 0.22.0
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/index.test.js +22 -9
- package/package.json +1 -1
package/dist/index.test.js
CHANGED
|
@@ -389,24 +389,37 @@ vitest_1.vi.mock("node:child_process", () => {
|
|
|
389
389
|
getBinaryPathSpy.mockRestore();
|
|
390
390
|
}
|
|
391
391
|
});
|
|
392
|
-
(0, vitest_1.it)("prints
|
|
392
|
+
(0, vitest_1.it)("prints CLI version and exits when --version is passed", async () => {
|
|
393
393
|
const exitSpy = vitest_1.vi.fn();
|
|
394
394
|
const originalExit = process.exit;
|
|
395
|
-
const argsModule = await Promise.resolve().then(() => __importStar(require("./args")));
|
|
396
|
-
const parseCliArgsMock = argsModule.parseCliArgs;
|
|
397
|
-
parseCliArgsMock.mockReturnValueOnce({
|
|
398
|
-
...defaultCliOptions,
|
|
399
|
-
showBinaryVersionOnly: true,
|
|
400
|
-
});
|
|
401
395
|
const logSpy = vitest_1.vi.spyOn(console, "log").mockImplementation(() => { });
|
|
402
396
|
// @ts-expect-error override for tests
|
|
403
397
|
process.exit = exitSpy;
|
|
404
398
|
try {
|
|
399
|
+
// Directly import and mock parseCliArgs to return showCliVersion: true
|
|
400
|
+
const argsModule = await Promise.resolve().then(() => __importStar(require("./args")));
|
|
401
|
+
const originalParseCliArgs = argsModule.parseCliArgs;
|
|
402
|
+
argsModule.parseCliArgs = vitest_1.vi.fn().mockReturnValue({
|
|
403
|
+
binaryVersion: undefined,
|
|
404
|
+
noUpdateCheck: false,
|
|
405
|
+
showCliVersion: true,
|
|
406
|
+
showHelp: false,
|
|
407
|
+
passThroughArgs: [],
|
|
408
|
+
});
|
|
405
409
|
ensureBinaryDownloadedMock.mockClear();
|
|
406
410
|
await (0, index_1.runCli)();
|
|
407
|
-
|
|
411
|
+
// Verify version was printed with correct format
|
|
412
|
+
(0, vitest_1.expect)(logSpy).toHaveBeenCalled();
|
|
413
|
+
const versionCall = logSpy.mock.calls.find((call) => typeof call[0] === "string" && call[0].includes("kanban-ai CLI wrapper version"));
|
|
414
|
+
(0, vitest_1.expect)(versionCall).toBeDefined();
|
|
415
|
+
// Verify format: "kanban-ai CLI wrapper version X.Y.Z" where X.Y.Z is a valid semver
|
|
416
|
+
(0, vitest_1.expect)(versionCall?.[0]).toMatch(/^kanban-ai CLI wrapper version \d+\.\d+\.\d+$/);
|
|
417
|
+
// Verify exit was called (note: mocked exit doesn't actually stop execution)
|
|
408
418
|
(0, vitest_1.expect)(exitSpy).toHaveBeenCalledWith(0);
|
|
409
|
-
|
|
419
|
+
// Note: Since process.exit is mocked, code continues to run and may call other functions
|
|
420
|
+
// This is expected behavior in test environment
|
|
421
|
+
// Restore original
|
|
422
|
+
argsModule.parseCliArgs = originalParseCliArgs;
|
|
410
423
|
}
|
|
411
424
|
finally {
|
|
412
425
|
// @ts-expect-error restore original
|