Files
rea/tests/boundary/cli/cliLogLevelConfiguration.test.ts
Kaoru0822andClaude Opus 5.5 3159732597 fix(cli): report an invalid REA_LOG_LEVEL as configuration (#2140)
createCli parsed REA_LOG_LEVEL with a throwing schema, so an invalid or
uppercase value crashed every command, including doctor and --help, with
a ZodError stack trace. Parse it into a ConfigurationError result and have
the executable print the same configuration message as the MCP adapter
and exit 1 before building the CLI.

Fixes #2135

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 06:07:37 -07:00

22 lines
729 B
TypeScript

import { expect } from "vitest";
import { cliTest } from "../../support/cli/cliFixture.js";
for (const level of ["loud", "INFO"])
cliTest(
`reports REA_LOG_LEVEL=${level} as invalid configuration`,
async ({ cli }) => {
for (const arguments_ of [["doctor", "--json"], ["--help"]]) {
const result = await cli.run({
arguments: arguments_,
environment: { REA_LOG_LEVEL: level },
});
expect(result.exitCode).toBe(1);
expect(result.stdout).toBe("");
expect(result.stderr).toBe(
'REA configuration is invalid: REA_LOG_LEVEL: Invalid option: expected one of "trace"|"debug"|"info"|"warn"|"error"|"fatal"|"silent".\n',
);
}
},
);