refactor: fix exit status code

This commit is contained in:
Catriel Müller
2026-05-13 13:54:51 -03:00
parent d541f851df
commit 7f6fe7feac
2 changed files with 5 additions and 2 deletions
@@ -180,6 +180,8 @@ export async function handle(args: ArgumentsCamelCase) {
if (models.length === 0) {
if (!args.quiet && !structured) UI.println(`${color(UI.Style.TEXT_WARNING)}No models to test after filtering.${color(UI.Style.TEXT_NORMAL)}`)
if (json) console.log(JSON.stringify([], null, 2))
if (args.output === "md") console.log(formatMarkdown([]))
if (structured) return
process.exitCode = 1
return
}
@@ -134,6 +134,7 @@ describe("handle", () => {
test("does not print progress before markdown output", async () => {
const logs: string[] = []
const print = console.log
const code = process.exitCode
console.log = (msg?: unknown) => {
logs.push(String(msg))
@@ -152,9 +153,9 @@ describe("handle", () => {
})
} finally {
console.log = print
process.exitCode = undefined
process.exitCode = code
}
expect(logs).toEqual([])
expect(logs).toEqual([formatMarkdown([])])
})
})