feat: make results directory output optional (#107)
Add -o, --output-dir option to both client and server commands. By default, no results directory is created - only console output. When -o is specified, results are saved to that directory with timestamped subdirectories. This eliminates the need to add 'results/' to .gitignore in every repo where conformance tests are run. Claude-Generated-By: Claude Code (cli/claude-opus-4-5=100%) Claude-Steers: 0 Claude-Permission-Prompts: 2 Claude-Escapes: 0
This commit is contained in:
parent
49311c7930
commit
62875097f4
1 changed files with 81 additions and 49 deletions
18
src/index.ts
18
src/index.ts
|
|
@ -39,11 +39,13 @@ program
|
|||
.option('--scenario <scenario>', 'Scenario to test')
|
||||
.option('--suite <suite>', 'Run a suite of tests in parallel (e.g., "auth")')
|
||||
.option('--timeout <ms>', 'Timeout in milliseconds', '30000')
|
||||
.option('-o, --output-dir <path>', 'Save results to this directory')
|
||||
.option('--verbose', 'Show verbose output')
|
||||
.action(async (options) => {
|
||||
try {
|
||||
const timeout = parseInt(options.timeout, 10);
|
||||
const verbose = options.verbose ?? false;
|
||||
const outputDir = options.outputDir;
|
||||
|
||||
// Handle suite mode
|
||||
if (options.suite) {
|
||||
|
|
@ -78,7 +80,8 @@ program
|
|||
const result = await runConformanceTest(
|
||||
options.command,
|
||||
scenarioName,
|
||||
timeout
|
||||
timeout,
|
||||
outputDir
|
||||
);
|
||||
return {
|
||||
scenario: scenarioName,
|
||||
|
|
@ -163,7 +166,7 @@ program
|
|||
|
||||
// If no command provided, run in interactive mode
|
||||
if (!validated.command) {
|
||||
await runInteractiveMode(validated.scenario, verbose);
|
||||
await runInteractiveMode(validated.scenario, verbose, outputDir);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +174,8 @@ program
|
|||
const result = await runConformanceTest(
|
||||
validated.command,
|
||||
validated.scenario,
|
||||
timeout
|
||||
timeout,
|
||||
outputDir
|
||||
);
|
||||
|
||||
const { overallFailure } = printClientResults(
|
||||
|
|
@ -209,6 +213,7 @@ program
|
|||
'Suite to run: "active" (default, excludes pending), "all", or "pending"',
|
||||
'active'
|
||||
)
|
||||
.option('-o, --output-dir <path>', 'Save results to this directory')
|
||||
.option('--verbose', 'Show verbose output (JSON instead of pretty print)')
|
||||
.action(async (options) => {
|
||||
try {
|
||||
|
|
@ -216,12 +221,14 @@ program
|
|||
const validated = ServerOptionsSchema.parse(options);
|
||||
|
||||
const verbose = options.verbose ?? false;
|
||||
const outputDir = options.outputDir;
|
||||
|
||||
// If a single scenario is specified, run just that one
|
||||
if (validated.scenario) {
|
||||
const result = await runServerConformanceTest(
|
||||
validated.url,
|
||||
validated.scenario
|
||||
validated.scenario,
|
||||
outputDir
|
||||
);
|
||||
|
||||
const { failed } = printServerResults(
|
||||
|
|
@ -259,7 +266,8 @@ program
|
|||
try {
|
||||
const result = await runServerConformanceTest(
|
||||
validated.url,
|
||||
scenarioName
|
||||
scenarioName,
|
||||
outputDir
|
||||
);
|
||||
allResults.push({ scenario: scenarioName, checks: result.checks });
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue