Skip to content

Commit c5fcafd

Browse files
boneskullclaude
andcommitted
fix(types): move re-export to proper location and add missing test
Address PR review comments: - Move createRunId/createTaskId re-export near other type re-exports to avoid separating JSDoc from its ReporterConfig type definition - Add test for --no-json-pretty overriding config prettyPrint: true to ensure comprehensive CLI precedence coverage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 239b83d commit c5fcafd

File tree

2 files changed

+50
-11
lines changed

2 files changed

+50
-11
lines changed

src/types/core.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ export type {
8282

8383
export type { ModestBenchConfig };
8484

85+
// Re-export schema-derived types
86+
export type {
87+
BenchmarkDefinition,
88+
BenchmarkDefinitionInput,
89+
BenchmarkSuite,
90+
BenchmarkSuiteInput,
91+
BenchmarkTask,
92+
BenchmarkTaskInput,
93+
} from '../core/benchmark-schema.js';
94+
8595
/**
8696
* CI/CD environment information
8797
*/
@@ -112,15 +122,8 @@ export interface CiInfo {
112122
* safety and consistency.
113123
*/
114124

115-
// Re-export schema-derived types
116-
export type {
117-
BenchmarkDefinition,
118-
BenchmarkDefinitionInput,
119-
BenchmarkSuite,
120-
BenchmarkSuiteInput,
121-
BenchmarkTask,
122-
BenchmarkTaskInput,
123-
} from '../core/benchmark-schema.js';
125+
// Re-export identifier helper functions
126+
export { createRunId, createTaskId } from '../utils/identifiers.js';
124127

125128
/**
126129
* CPU information
@@ -300,8 +303,6 @@ export interface MemoryInfo {
300303
readonly used: number;
301304
}
302305

303-
// Re-export identifier helper functions
304-
export { createRunId, createTaskId } from '../utils/identifiers.js';
305306
/**
306307
* Reporter-specific configuration
307308
*

test/integration/json-pretty.test.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,5 +201,43 @@ describe('JSON reporter prettyPrint configuration', () => {
201201
const lines = jsonContent.trim().split('\n');
202202
expect(lines.length, 'to be greater than', 1);
203203
});
204+
205+
it('--no-json-pretty should override config prettyPrint: true', async () => {
206+
const outputFile = join(tempDir, 'results.json');
207+
208+
// Create a config file with prettyPrint: true
209+
const configPath = join(tempDir, 'modestbench.config.json');
210+
await writeFile(
211+
configPath,
212+
JSON.stringify({
213+
reporterConfig: {
214+
json: {
215+
prettyPrint: true,
216+
},
217+
},
218+
}),
219+
);
220+
221+
// CLI flag --no-json-pretty should override the config
222+
const result = await runCommand([
223+
'run',
224+
fixtures.simple,
225+
'--config',
226+
configPath,
227+
'--reporter',
228+
'json',
229+
'--no-json-pretty',
230+
'--output-file',
231+
outputFile,
232+
]);
233+
234+
expect(result.exitCode, 'to equal', 0);
235+
236+
const jsonContent = await readFile(outputFile, 'utf-8');
237+
238+
// Should be compact despite config setting prettyPrint: true
239+
const lines = jsonContent.trim().split('\n');
240+
expect(lines.length, 'to equal', 1);
241+
});
204242
});
205243
});

0 commit comments

Comments
 (0)