modestbench 0.8.0 → 0.9.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/CHANGELOG.md +13 -0
- package/README.md +37 -4
- package/dist/adapters/types.d.cts +1 -1
- package/dist/adapters/types.d.cts.map +1 -1
- package/dist/adapters/types.d.ts +1 -1
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/cli/commands/run.cjs +9 -5
- package/dist/cli/commands/run.cjs.map +1 -1
- package/dist/cli/commands/run.d.cts +1 -0
- package/dist/cli/commands/run.d.cts.map +1 -1
- package/dist/cli/commands/run.d.ts +1 -0
- package/dist/cli/commands/run.d.ts.map +1 -1
- package/dist/cli/commands/run.js +10 -6
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/index.cjs +7 -1
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +7 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/{core → config}/benchmark-schema.cjs +1 -1
- package/dist/config/benchmark-schema.cjs.map +1 -0
- package/dist/config/benchmark-schema.d.cts +913 -0
- package/dist/config/benchmark-schema.d.cts.map +1 -0
- package/dist/config/benchmark-schema.d.ts +913 -0
- package/dist/config/benchmark-schema.d.ts.map +1 -0
- package/dist/{core → config}/benchmark-schema.js +1 -1
- package/dist/config/benchmark-schema.js.map +1 -0
- package/dist/config/schema.cjs +188 -105
- package/dist/config/schema.cjs.map +1 -1
- package/dist/config/schema.d.cts +208 -80
- package/dist/config/schema.d.cts.map +1 -1
- package/dist/config/schema.d.ts +208 -80
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +187 -104
- package/dist/config/schema.js.map +1 -1
- package/dist/core/engine.cjs +50 -45
- package/dist/core/engine.cjs.map +1 -1
- package/dist/core/engine.d.cts.map +1 -1
- package/dist/core/engine.d.ts.map +1 -1
- package/dist/core/engine.js +50 -45
- package/dist/core/engine.js.map +1 -1
- package/dist/core/output-path-resolver.cjs +15 -1
- package/dist/core/output-path-resolver.cjs.map +1 -1
- package/dist/core/output-path-resolver.d.cts +8 -0
- package/dist/core/output-path-resolver.d.cts.map +1 -1
- package/dist/core/output-path-resolver.d.ts +8 -0
- package/dist/core/output-path-resolver.d.ts.map +1 -1
- package/dist/core/output-path-resolver.js +13 -0
- package/dist/core/output-path-resolver.js.map +1 -1
- package/dist/reporters/json.cjs +1 -1
- package/dist/reporters/json.cjs.map +1 -1
- package/dist/reporters/json.js +1 -1
- package/dist/reporters/json.js.map +1 -1
- package/dist/schema/modestbench-config.schema.json +94 -87
- package/dist/services/budget-evaluator.cjs +8 -6
- package/dist/services/budget-evaluator.cjs.map +1 -1
- package/dist/services/budget-evaluator.d.cts +2 -2
- package/dist/services/budget-evaluator.d.cts.map +1 -1
- package/dist/services/budget-evaluator.d.ts +2 -2
- package/dist/services/budget-evaluator.d.ts.map +1 -1
- package/dist/services/budget-evaluator.js +8 -6
- package/dist/services/budget-evaluator.js.map +1 -1
- package/dist/services/budget-resolver.cjs +214 -0
- package/dist/services/budget-resolver.cjs.map +1 -0
- package/dist/services/budget-resolver.d.cts +98 -0
- package/dist/services/budget-resolver.d.cts.map +1 -0
- package/dist/services/budget-resolver.d.ts +98 -0
- package/dist/services/budget-resolver.d.ts.map +1 -0
- package/dist/services/budget-resolver.js +203 -0
- package/dist/services/budget-resolver.js.map +1 -0
- package/dist/services/file-loader.cjs +1 -1
- package/dist/services/file-loader.cjs.map +1 -1
- package/dist/services/file-loader.js +1 -1
- package/dist/services/file-loader.js.map +1 -1
- package/dist/types/budgets.d.cts +31 -0
- package/dist/types/budgets.d.cts.map +1 -1
- package/dist/types/budgets.d.ts +31 -0
- package/dist/types/budgets.d.ts.map +1 -1
- package/dist/types/core.cjs.map +1 -1
- package/dist/types/core.d.cts +28 -75
- package/dist/types/core.d.cts.map +1 -1
- package/dist/types/core.d.ts +28 -75
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/core.js.map +1 -1
- package/package.json +18 -7
- package/src/adapters/types.ts +1 -1
- package/src/cli/commands/run.ts +17 -5
- package/src/cli/index.ts +8 -1
- package/src/{core → config}/benchmark-schema.ts +1 -1
- package/src/config/schema.ts +379 -302
- package/src/core/engine.ts +74 -69
- package/src/core/output-path-resolver.ts +14 -0
- package/src/reporters/json.ts +1 -1
- package/src/services/budget-evaluator.ts +13 -9
- package/src/services/budget-resolver.ts +254 -0
- package/src/services/file-loader.ts +1 -1
- package/src/types/budgets.ts +38 -0
- package/src/types/core.ts +64 -99
- package/dist/core/benchmark-schema.cjs.map +0 -1
- package/dist/core/benchmark-schema.d.cts +0 -139
- package/dist/core/benchmark-schema.d.cts.map +0 -1
- package/dist/core/benchmark-schema.d.ts +0 -139
- package/dist/core/benchmark-schema.d.ts.map +0 -1
- package/dist/core/benchmark-schema.js.map +0 -1
package/dist/types/core.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import type { jsonReporterConfigSchema, ModestBenchConfig, ModestBenchConfigInput, reporterConfigSchema } from "../config/schema.js";
|
|
3
|
+
import type { AbsoluteBudget, BaselineReference, BaselineStorage, BaselineSummaryData, Budget, BudgetPattern, BudgetResult, BudgetSummary, BudgetViolation, RelativeBudget, ResolvedBudgets, RunId, TaskId } from "./budgets.js";
|
|
4
4
|
/**
|
|
5
5
|
* Benchmark file structure after parsing
|
|
6
6
|
*/
|
|
@@ -14,18 +14,6 @@ export interface BenchmarkFile {
|
|
|
14
14
|
/** File metadata */
|
|
15
15
|
readonly metadata: FileMetadata;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* ModestBench Core Types
|
|
19
|
-
*
|
|
20
|
-
* Defines the fundamental data structures used throughout the ModestBench
|
|
21
|
-
* system. These types represent benchmark results, metadata, configuration, and
|
|
22
|
-
* system state.
|
|
23
|
-
*
|
|
24
|
-
* Note: BenchmarkDefinition, BenchmarkSuite, and BenchmarkTask types are
|
|
25
|
-
* derived from Zod schemas and re-exported from benchmark-schema.ts for type
|
|
26
|
-
* safety and consistency.
|
|
27
|
-
*/
|
|
28
|
-
export { createRunId, createTaskId } from "../utils/identifiers.js";
|
|
29
17
|
/**
|
|
30
18
|
* Represents a complete benchmark run across multiple files
|
|
31
19
|
*/
|
|
@@ -57,6 +45,9 @@ export interface BenchmarkRun {
|
|
|
57
45
|
/** Run-level tags */
|
|
58
46
|
readonly tags?: string[];
|
|
59
47
|
}
|
|
48
|
+
export type { AbsoluteBudget, BaselineReference, BaselineStorage, BaselineSummaryData, Budget, BudgetPattern, BudgetResult, BudgetSummary, BudgetViolation, RelativeBudget, ResolvedBudgets, RunId, TaskId, };
|
|
49
|
+
export type { ModestBenchConfig, ModestBenchConfigInput };
|
|
50
|
+
export type { BenchmarkDefinition, BenchmarkDefinitionInput, BenchmarkSuite, BenchmarkSuiteInput, BenchmarkTask, BenchmarkTaskInput, } from "../config/benchmark-schema.js";
|
|
60
51
|
/**
|
|
61
52
|
* CI/CD environment information
|
|
62
53
|
*/
|
|
@@ -74,6 +65,18 @@ export interface CiInfo {
|
|
|
74
65
|
/** Pull request number */
|
|
75
66
|
readonly pullRequest?: string;
|
|
76
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* ModestBench Core Types
|
|
70
|
+
*
|
|
71
|
+
* Defines the fundamental data structures used throughout the ModestBench
|
|
72
|
+
* system. These types represent benchmark results, metadata, configuration, and
|
|
73
|
+
* system state.
|
|
74
|
+
*
|
|
75
|
+
* Note: BenchmarkDefinition, BenchmarkSuite, and BenchmarkTask types are
|
|
76
|
+
* derived from Zod schemas and re-exported from benchmark-schema.ts for type
|
|
77
|
+
* safety and consistency.
|
|
78
|
+
*/
|
|
79
|
+
export { createRunId, createTaskId } from "../utils/identifiers.js";
|
|
77
80
|
/**
|
|
78
81
|
* CPU information
|
|
79
82
|
*/
|
|
@@ -217,6 +220,10 @@ export interface GitInfo {
|
|
|
217
220
|
/** Commit timestamp */
|
|
218
221
|
readonly timestamp: Date;
|
|
219
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Configuration options for the JSON reporter
|
|
225
|
+
*/
|
|
226
|
+
export type JsonReporterConfig = z.infer<typeof jsonReporterConfigSchema>;
|
|
220
227
|
/**
|
|
221
228
|
* Memory information
|
|
222
229
|
*/
|
|
@@ -229,68 +236,12 @@ export interface MemoryInfo {
|
|
|
229
236
|
readonly used: number;
|
|
230
237
|
}
|
|
231
238
|
/**
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
* The JSON Schema for this configuration is available at
|
|
235
|
-
* `dist/schema/modestbench-config.schema.json` after building the project.
|
|
236
|
-
*
|
|
237
|
-
* Config files can optionally include a `$schema` property pointing to the
|
|
238
|
-
* schema file for IDE autocomplete and validation support.
|
|
239
|
+
* Reporter-specific configuration
|
|
239
240
|
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* ```json
|
|
243
|
-
* {
|
|
244
|
-
* "$schema": "./node_modules/modestbench/dist/schema/modestbench-config.schema.json",
|
|
245
|
-
* "iterations": 1000,
|
|
246
|
-
* "reporters": ["human", "json"],
|
|
247
|
-
* "time": 5000
|
|
248
|
-
* }
|
|
249
|
-
* ```
|
|
241
|
+
* Provides typed configuration for known reporters. Unknown reporter configs
|
|
242
|
+
* are allowed via index signature.
|
|
250
243
|
*/
|
|
251
|
-
export
|
|
252
|
-
readonly $schema?: string | undefined;
|
|
253
|
-
/** Whether to stop on first failure */
|
|
254
|
-
readonly bail: boolean;
|
|
255
|
-
/** Name of baseline to use for relative budget comparisons */
|
|
256
|
-
readonly baseline?: string | undefined;
|
|
257
|
-
/** How to handle budget violations: 'fail', 'warn', or 'report' */
|
|
258
|
-
readonly budgetMode?: 'fail' | 'report' | 'warn' | undefined;
|
|
259
|
-
/** Performance budgets mapped by task identifier */
|
|
260
|
-
readonly budgets?: Record<string, unknown> | undefined;
|
|
261
|
-
/** Patterns to exclude from discovery */
|
|
262
|
-
readonly exclude: string[];
|
|
263
|
-
/** Tags to exclude from execution */
|
|
264
|
-
readonly excludeTags: string[];
|
|
265
|
-
/** Default number of iterations per task */
|
|
266
|
-
readonly iterations: number;
|
|
267
|
-
/** How to limit benchmark execution: 'time', 'iterations', 'any', or 'all' */
|
|
268
|
-
readonly limitBy: 'all' | 'any' | 'iterations' | 'time';
|
|
269
|
-
/** Custom metadata to attach to runs */
|
|
270
|
-
readonly metadata: Record<string, unknown>;
|
|
271
|
-
/** Output directory for reports (undefined means stdout for data reporters) */
|
|
272
|
-
readonly outputDir?: string;
|
|
273
|
-
/** Pattern(s) for discovering benchmark files */
|
|
274
|
-
readonly pattern: string | string[];
|
|
275
|
-
/** Whether to run in quiet mode */
|
|
276
|
-
readonly quiet: boolean;
|
|
277
|
-
/** Configuration for specific reporters */
|
|
278
|
-
readonly reporterConfig: Record<string, unknown>;
|
|
279
|
-
/** Reporters to use for output */
|
|
280
|
-
readonly reporters: string[];
|
|
281
|
-
/** Tags to include (if empty, include all) */
|
|
282
|
-
readonly tags: string[];
|
|
283
|
-
/** Threshold configuration for performance assertions */
|
|
284
|
-
readonly thresholds: ThresholdConfig;
|
|
285
|
-
/** Maximum time to spend on each task in milliseconds */
|
|
286
|
-
readonly time: number;
|
|
287
|
-
/** Timeout for individual tasks in milliseconds */
|
|
288
|
-
readonly timeout: number;
|
|
289
|
-
/** Whether to run in verbose mode */
|
|
290
|
-
readonly verbose: boolean;
|
|
291
|
-
/** Number of warmup iterations before measurement */
|
|
292
|
-
readonly warmup: number;
|
|
293
|
-
}
|
|
244
|
+
export type ReporterConfig = z.infer<typeof reporterConfigSchema>;
|
|
294
245
|
/**
|
|
295
246
|
* Summary statistics for a benchmark run
|
|
296
247
|
*/
|
|
@@ -376,6 +327,8 @@ export interface TaskResult {
|
|
|
376
327
|
}
|
|
377
328
|
/**
|
|
378
329
|
* Threshold configuration for performance assertions
|
|
330
|
+
*
|
|
331
|
+
* TODO: Derive from thresholdConfigSchema via z.infer (see #15)
|
|
379
332
|
*/
|
|
380
333
|
export interface ThresholdConfig {
|
|
381
334
|
/** Maximum allowed margin of error percentage */
|
package/dist/types/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACrB,4BAA4B;AAE7B,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,cAAc,EACd,eAAe,EACf,KAAK,EACL,MAAM,EACP,qBAAqB;AAEtB;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,gCAAgC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,oBAAoB;IACpB,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,aAAa,CAAC,EAAE,aAAa,CAAC;IACvC,qCAAqC;IACrC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mCAAmC;IACnC,QAA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,MAAM,CAAC;IACtB,mDAAmD;IACnD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,oDAAoD;IACpD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,yDAAyD;IACzD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,2CAA2C;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,yCAAyC;IACzC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,6CAA6C;IAC7C,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC"}
|
package/dist/types/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/types/core.ts"],"names":[],"mappings":"AAqHA;;;;;;;;;;GAUG;AAEH,wCAAwC;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,gCAAgC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modestbench",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A full-ass benchmarking framework for Node.js",
|
|
6
6
|
"repository": {
|
|
@@ -100,7 +100,6 @@
|
|
|
100
100
|
"docs:preview": "astro preview --config astro.config.js",
|
|
101
101
|
"fix": "run-s -sl fix:*",
|
|
102
102
|
"fix:eslint": "eslint --fix .",
|
|
103
|
-
"fix:pkg": "npm pkg fix",
|
|
104
103
|
"fix:prettier": "prettier --write . && markdownlint-cli2 --fix \"**/*.md\"",
|
|
105
104
|
"lint": "run-p -sl --aggregate-output lint:*",
|
|
106
105
|
"lint-staged": "lint-staged",
|
|
@@ -136,21 +135,21 @@
|
|
|
136
135
|
"@astrojs/starlight": "0.37.1",
|
|
137
136
|
"@commitlint/cli": "20.2.0",
|
|
138
137
|
"@commitlint/config-conventional": "20.2.0",
|
|
139
|
-
"@eslint/js": "9.39.
|
|
138
|
+
"@eslint/js": "9.39.2",
|
|
140
139
|
"@jest/globals": "30.2.0",
|
|
141
140
|
"@pasqal-io/starlight-client-mermaid": "0.1.0",
|
|
142
141
|
"@stylistic/eslint-plugin": "5.6.1",
|
|
143
142
|
"@types/mocha": "10.0.10",
|
|
144
|
-
"@types/node": "24.10.
|
|
143
|
+
"@types/node": "24.10.4",
|
|
145
144
|
"@types/wallabyjs": "0.0.15",
|
|
146
145
|
"@types/yargs": "17.0.35",
|
|
147
|
-
"asciinema-player": "3.13.
|
|
146
|
+
"asciinema-player": "3.13.5",
|
|
148
147
|
"astro": "5.16.5",
|
|
149
148
|
"astro-broken-link-checker": "file:./vendor/astro-broken-link-checker",
|
|
150
149
|
"ava": "6.4.1",
|
|
151
150
|
"bupkis": "0.14.0",
|
|
152
151
|
"cspell": "9.4.0",
|
|
153
|
-
"eslint": "9.39.
|
|
152
|
+
"eslint": "9.39.2",
|
|
154
153
|
"eslint-plugin-jsonc": "2.21.0",
|
|
155
154
|
"eslint-plugin-perfectionist": "4.15.1",
|
|
156
155
|
"globals": "16.5.0",
|
|
@@ -163,6 +162,7 @@
|
|
|
163
162
|
"mocha": "11.7.5",
|
|
164
163
|
"npm-run-all2": "8.0.4",
|
|
165
164
|
"prettier": "3.7.4",
|
|
165
|
+
"prettier-plugin-astro": "0.14.1",
|
|
166
166
|
"prettier-plugin-jsdoc": "1.8.0",
|
|
167
167
|
"prettier-plugin-pkg": "0.21.2",
|
|
168
168
|
"prettier-plugin-sort-json": "4.1.1",
|
|
@@ -181,7 +181,6 @@
|
|
|
181
181
|
"@types/wallabyjs",
|
|
182
182
|
"@types/mocha",
|
|
183
183
|
"markdownlint-cli2-formatter-pretty",
|
|
184
|
-
"asciinema-player",
|
|
185
184
|
"@astrojs/mdx",
|
|
186
185
|
"astro-broken-link-checker",
|
|
187
186
|
"jest",
|
|
@@ -215,6 +214,9 @@
|
|
|
215
214
|
}
|
|
216
215
|
},
|
|
217
216
|
"lint-staged": {
|
|
217
|
+
"*.{astro,css}": [
|
|
218
|
+
"prettier --write"
|
|
219
|
+
],
|
|
218
220
|
"*.{ts,cts,js,cjs,yml,json5}": [
|
|
219
221
|
"eslint --fix",
|
|
220
222
|
"prettier --write",
|
|
@@ -238,7 +240,16 @@
|
|
|
238
240
|
"prettier": {
|
|
239
241
|
"jsdocCommentLineStrategy": "keep",
|
|
240
242
|
"jsdocPreferCodeFences": true,
|
|
243
|
+
"overrides": [
|
|
244
|
+
{
|
|
245
|
+
"files": "*.astro",
|
|
246
|
+
"options": {
|
|
247
|
+
"parser": "astro"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
],
|
|
241
251
|
"plugins": [
|
|
252
|
+
"prettier-plugin-astro",
|
|
242
253
|
"prettier-plugin-jsdoc",
|
|
243
254
|
"prettier-plugin-pkg",
|
|
244
255
|
"prettier-plugin-sort-json"
|
package/src/adapters/types.ts
CHANGED
package/src/cli/commands/run.ts
CHANGED
|
@@ -11,11 +11,15 @@ import type {
|
|
|
11
11
|
BenchmarkRun,
|
|
12
12
|
ModestBenchConfig,
|
|
13
13
|
Reporter,
|
|
14
|
+
ReporterConfig,
|
|
14
15
|
} from '../../types/index.js';
|
|
15
16
|
import type { CliContext } from '../index.js';
|
|
16
17
|
|
|
17
18
|
import { ErrorCodes, ExitCodes } from '../../constants.js';
|
|
18
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
generateTimestampedFilename,
|
|
21
|
+
resolveOutputPath,
|
|
22
|
+
} from '../../core/output-path-resolver.js';
|
|
19
23
|
import {
|
|
20
24
|
type BudgetExceededError,
|
|
21
25
|
InvalidArgumentError,
|
|
@@ -61,6 +65,7 @@ interface RunOptions {
|
|
|
61
65
|
excludeTags?: string[] | undefined;
|
|
62
66
|
iterations?: number | undefined;
|
|
63
67
|
json?: boolean | undefined;
|
|
68
|
+
jsonPretty?: boolean | undefined;
|
|
64
69
|
noColor?: boolean | undefined;
|
|
65
70
|
outputDir?: string | undefined;
|
|
66
71
|
outputFile?: string | undefined;
|
|
@@ -126,6 +131,7 @@ export const handleRunCommand = async (
|
|
|
126
131
|
options.outputDir,
|
|
127
132
|
options.outputFile,
|
|
128
133
|
options.progress,
|
|
134
|
+
options.jsonPretty,
|
|
129
135
|
);
|
|
130
136
|
|
|
131
137
|
// Step 3: Discovery phase
|
|
@@ -389,7 +395,7 @@ const setupReporters = async (
|
|
|
389
395
|
context: CliContext,
|
|
390
396
|
config: {
|
|
391
397
|
outputDir?: string;
|
|
392
|
-
reporterConfig?:
|
|
398
|
+
reporterConfig?: ReporterConfig;
|
|
393
399
|
reporters?: string[];
|
|
394
400
|
},
|
|
395
401
|
isVerbose: boolean,
|
|
@@ -398,6 +404,7 @@ const setupReporters = async (
|
|
|
398
404
|
explicitOutputDir?: string,
|
|
399
405
|
explicitOutputFile?: string,
|
|
400
406
|
progressOption?: boolean,
|
|
407
|
+
explicitJsonPretty?: boolean,
|
|
401
408
|
): Promise<Reporter[]> => {
|
|
402
409
|
try {
|
|
403
410
|
const reporters: Reporter[] = [];
|
|
@@ -426,7 +433,7 @@ const setupReporters = async (
|
|
|
426
433
|
const outputPath = resolveOutputPath(
|
|
427
434
|
outputDir,
|
|
428
435
|
explicitOutputFile,
|
|
429
|
-
'
|
|
436
|
+
generateTimestampedFilename('csv'),
|
|
430
437
|
);
|
|
431
438
|
reporter = new CsvReporter({
|
|
432
439
|
includeHeaders: true,
|
|
@@ -451,11 +458,16 @@ const setupReporters = async (
|
|
|
451
458
|
const outputPath = resolveOutputPath(
|
|
452
459
|
outputDir,
|
|
453
460
|
explicitOutputFile,
|
|
454
|
-
'
|
|
461
|
+
generateTimestampedFilename('json'),
|
|
455
462
|
);
|
|
463
|
+
// Precedence: CLI flag > config file > default (false)
|
|
464
|
+
const prettyPrint =
|
|
465
|
+
explicitJsonPretty ??
|
|
466
|
+
config.reporterConfig?.json?.prettyPrint ??
|
|
467
|
+
false;
|
|
456
468
|
reporter = new JsonReporter({
|
|
457
469
|
...(outputPath ? { outputPath } : {}),
|
|
458
|
-
prettyPrint
|
|
470
|
+
prettyPrint,
|
|
459
471
|
});
|
|
460
472
|
break;
|
|
461
473
|
}
|
package/src/cli/index.ts
CHANGED
|
@@ -276,6 +276,12 @@ export const main = async (
|
|
|
276
276
|
'Benchmark engine: tinybench (default) or accurate (requires --allow-natives-syntax)',
|
|
277
277
|
type: 'string',
|
|
278
278
|
})
|
|
279
|
+
.option('json-pretty', {
|
|
280
|
+
defaultDescription: 'false',
|
|
281
|
+
description:
|
|
282
|
+
'Pretty-print JSON output (only affects json reporter)',
|
|
283
|
+
type: 'boolean',
|
|
284
|
+
})
|
|
279
285
|
.example([
|
|
280
286
|
['$0 run', 'Run benchmarks in current directory and bench/'],
|
|
281
287
|
['$0 run benchmarks/', 'Run all benchmarks in a directory'],
|
|
@@ -315,6 +321,7 @@ export const main = async (
|
|
|
315
321
|
excludeTags: argv['exclude-tag'],
|
|
316
322
|
iterations: argv.iterations,
|
|
317
323
|
json: argv.json,
|
|
324
|
+
jsonPretty: argv['json-pretty'],
|
|
318
325
|
noColor: argv.noColor,
|
|
319
326
|
outputDir: argv.output,
|
|
320
327
|
outputFile: argv['output-file'],
|
|
@@ -1133,7 +1140,7 @@ const createCliContext = async (
|
|
|
1133
1140
|
engine.registerReporter(
|
|
1134
1141
|
'json',
|
|
1135
1142
|
new JsonReporter({
|
|
1136
|
-
prettyPrint:
|
|
1143
|
+
prettyPrint: false,
|
|
1137
1144
|
}),
|
|
1138
1145
|
);
|
|
1139
1146
|
|
|
@@ -11,7 +11,7 @@ import { z } from 'zod';
|
|
|
11
11
|
|
|
12
12
|
import type { ModestBenchConfig } from '../types/core.js';
|
|
13
13
|
|
|
14
|
-
import { partialModestBenchConfigSchema } from '
|
|
14
|
+
import { partialModestBenchConfigSchema } from './schema.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Schema for benchmark functions
|