modestbench 0.0.1

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.
Files changed (275) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/LICENSE.md +55 -0
  3. package/README.md +699 -0
  4. package/dist/bootstrap.cjs +37 -0
  5. package/dist/bootstrap.cjs.map +1 -0
  6. package/dist/bootstrap.d.cts +17 -0
  7. package/dist/bootstrap.d.cts.map +1 -0
  8. package/dist/bootstrap.d.ts +17 -0
  9. package/dist/bootstrap.d.ts.map +1 -0
  10. package/dist/bootstrap.js +33 -0
  11. package/dist/bootstrap.js.map +1 -0
  12. package/dist/cli/commands/history.cjs +459 -0
  13. package/dist/cli/commands/history.cjs.map +1 -0
  14. package/dist/cli/commands/history.d.cts +34 -0
  15. package/dist/cli/commands/history.d.cts.map +1 -0
  16. package/dist/cli/commands/history.d.ts +34 -0
  17. package/dist/cli/commands/history.d.ts.map +1 -0
  18. package/dist/cli/commands/history.js +422 -0
  19. package/dist/cli/commands/history.js.map +1 -0
  20. package/dist/cli/commands/init.cjs +566 -0
  21. package/dist/cli/commands/init.cjs.map +1 -0
  22. package/dist/cli/commands/init.d.cts +26 -0
  23. package/dist/cli/commands/init.d.cts.map +1 -0
  24. package/dist/cli/commands/init.d.ts +26 -0
  25. package/dist/cli/commands/init.d.ts.map +1 -0
  26. package/dist/cli/commands/init.js +562 -0
  27. package/dist/cli/commands/init.js.map +1 -0
  28. package/dist/cli/commands/run.cjs +285 -0
  29. package/dist/cli/commands/run.cjs.map +1 -0
  30. package/dist/cli/commands/run.d.cts +37 -0
  31. package/dist/cli/commands/run.d.cts.map +1 -0
  32. package/dist/cli/commands/run.d.ts +37 -0
  33. package/dist/cli/commands/run.d.ts.map +1 -0
  34. package/dist/cli/commands/run.js +248 -0
  35. package/dist/cli/commands/run.js.map +1 -0
  36. package/dist/cli/index.cjs +523 -0
  37. package/dist/cli/index.cjs.map +1 -0
  38. package/dist/cli/index.d.cts +58 -0
  39. package/dist/cli/index.d.cts.map +1 -0
  40. package/dist/cli/index.d.ts +58 -0
  41. package/dist/cli/index.d.ts.map +1 -0
  42. package/dist/cli/index.js +515 -0
  43. package/dist/cli/index.js.map +1 -0
  44. package/dist/config/manager.cjs +370 -0
  45. package/dist/config/manager.cjs.map +1 -0
  46. package/dist/config/manager.d.cts +46 -0
  47. package/dist/config/manager.d.cts.map +1 -0
  48. package/dist/config/manager.d.ts +46 -0
  49. package/dist/config/manager.d.ts.map +1 -0
  50. package/dist/config/manager.js +333 -0
  51. package/dist/config/manager.js.map +1 -0
  52. package/dist/config/schema.cjs +182 -0
  53. package/dist/config/schema.cjs.map +1 -0
  54. package/dist/config/schema.d.cts +51 -0
  55. package/dist/config/schema.d.cts.map +1 -0
  56. package/dist/config/schema.d.ts +51 -0
  57. package/dist/config/schema.d.ts.map +1 -0
  58. package/dist/config/schema.js +145 -0
  59. package/dist/config/schema.js.map +1 -0
  60. package/dist/constants.cjs +22 -0
  61. package/dist/constants.cjs.map +1 -0
  62. package/dist/constants.d.cts +10 -0
  63. package/dist/constants.d.cts.map +1 -0
  64. package/dist/constants.d.ts +10 -0
  65. package/dist/constants.d.ts.map +1 -0
  66. package/dist/constants.js +19 -0
  67. package/dist/constants.js.map +1 -0
  68. package/dist/core/benchmark-schema.cjs +135 -0
  69. package/dist/core/benchmark-schema.cjs.map +1 -0
  70. package/dist/core/benchmark-schema.d.cts +139 -0
  71. package/dist/core/benchmark-schema.d.cts.map +1 -0
  72. package/dist/core/benchmark-schema.d.ts +139 -0
  73. package/dist/core/benchmark-schema.d.ts.map +1 -0
  74. package/dist/core/benchmark-schema.js +132 -0
  75. package/dist/core/benchmark-schema.js.map +1 -0
  76. package/dist/core/engine.cjs +669 -0
  77. package/dist/core/engine.cjs.map +1 -0
  78. package/dist/core/engine.d.cts +128 -0
  79. package/dist/core/engine.d.cts.map +1 -0
  80. package/dist/core/engine.d.ts +128 -0
  81. package/dist/core/engine.d.ts.map +1 -0
  82. package/dist/core/engine.js +632 -0
  83. package/dist/core/engine.js.map +1 -0
  84. package/dist/core/engines/accurate-engine.cjs +292 -0
  85. package/dist/core/engines/accurate-engine.cjs.map +1 -0
  86. package/dist/core/engines/accurate-engine.d.cts +63 -0
  87. package/dist/core/engines/accurate-engine.d.cts.map +1 -0
  88. package/dist/core/engines/accurate-engine.d.ts +63 -0
  89. package/dist/core/engines/accurate-engine.d.ts.map +1 -0
  90. package/dist/core/engines/accurate-engine.js +288 -0
  91. package/dist/core/engines/accurate-engine.js.map +1 -0
  92. package/dist/core/engines/index.cjs +21 -0
  93. package/dist/core/engines/index.cjs.map +1 -0
  94. package/dist/core/engines/index.d.cts +16 -0
  95. package/dist/core/engines/index.d.cts.map +1 -0
  96. package/dist/core/engines/index.d.ts +16 -0
  97. package/dist/core/engines/index.d.ts.map +1 -0
  98. package/dist/core/engines/index.js +16 -0
  99. package/dist/core/engines/index.js.map +1 -0
  100. package/dist/core/engines/tinybench-engine.cjs +286 -0
  101. package/dist/core/engines/tinybench-engine.cjs.map +1 -0
  102. package/dist/core/engines/tinybench-engine.d.cts +18 -0
  103. package/dist/core/engines/tinybench-engine.d.cts.map +1 -0
  104. package/dist/core/engines/tinybench-engine.d.ts +18 -0
  105. package/dist/core/engines/tinybench-engine.d.ts.map +1 -0
  106. package/dist/core/engines/tinybench-engine.js +282 -0
  107. package/dist/core/engines/tinybench-engine.js.map +1 -0
  108. package/dist/core/error-manager.cjs +303 -0
  109. package/dist/core/error-manager.cjs.map +1 -0
  110. package/dist/core/error-manager.d.cts +77 -0
  111. package/dist/core/error-manager.d.cts.map +1 -0
  112. package/dist/core/error-manager.d.ts +77 -0
  113. package/dist/core/error-manager.d.ts.map +1 -0
  114. package/dist/core/error-manager.js +299 -0
  115. package/dist/core/error-manager.js.map +1 -0
  116. package/dist/core/loader.cjs +287 -0
  117. package/dist/core/loader.cjs.map +1 -0
  118. package/dist/core/loader.d.cts +55 -0
  119. package/dist/core/loader.d.cts.map +1 -0
  120. package/dist/core/loader.d.ts +55 -0
  121. package/dist/core/loader.d.ts.map +1 -0
  122. package/dist/core/loader.js +250 -0
  123. package/dist/core/loader.js.map +1 -0
  124. package/dist/core/stats-utils.cjs +99 -0
  125. package/dist/core/stats-utils.cjs.map +1 -0
  126. package/dist/core/stats-utils.d.cts +50 -0
  127. package/dist/core/stats-utils.d.cts.map +1 -0
  128. package/dist/core/stats-utils.d.ts +50 -0
  129. package/dist/core/stats-utils.d.ts.map +1 -0
  130. package/dist/core/stats-utils.js +94 -0
  131. package/dist/core/stats-utils.js.map +1 -0
  132. package/dist/index.cjs +64 -0
  133. package/dist/index.cjs.map +1 -0
  134. package/dist/index.d.cts +22 -0
  135. package/dist/index.d.cts.map +1 -0
  136. package/dist/index.d.ts +22 -0
  137. package/dist/index.d.ts.map +1 -0
  138. package/dist/index.js +30 -0
  139. package/dist/index.js.map +1 -0
  140. package/dist/progress/manager.cjs +325 -0
  141. package/dist/progress/manager.cjs.map +1 -0
  142. package/dist/progress/manager.d.cts +125 -0
  143. package/dist/progress/manager.d.cts.map +1 -0
  144. package/dist/progress/manager.d.ts +125 -0
  145. package/dist/progress/manager.d.ts.map +1 -0
  146. package/dist/progress/manager.js +321 -0
  147. package/dist/progress/manager.js.map +1 -0
  148. package/dist/reporters/csv.cjs +250 -0
  149. package/dist/reporters/csv.cjs.map +1 -0
  150. package/dist/reporters/csv.d.cts +92 -0
  151. package/dist/reporters/csv.d.cts.map +1 -0
  152. package/dist/reporters/csv.d.ts +92 -0
  153. package/dist/reporters/csv.d.ts.map +1 -0
  154. package/dist/reporters/csv.js +246 -0
  155. package/dist/reporters/csv.js.map +1 -0
  156. package/dist/reporters/human.cjs +516 -0
  157. package/dist/reporters/human.cjs.map +1 -0
  158. package/dist/reporters/human.d.cts +86 -0
  159. package/dist/reporters/human.d.cts.map +1 -0
  160. package/dist/reporters/human.d.ts +86 -0
  161. package/dist/reporters/human.d.ts.map +1 -0
  162. package/dist/reporters/human.js +509 -0
  163. package/dist/reporters/human.js.map +1 -0
  164. package/dist/reporters/index.cjs +17 -0
  165. package/dist/reporters/index.cjs.map +1 -0
  166. package/dist/reporters/index.d.cts +10 -0
  167. package/dist/reporters/index.d.cts.map +1 -0
  168. package/dist/reporters/index.d.ts +10 -0
  169. package/dist/reporters/index.d.ts.map +1 -0
  170. package/dist/reporters/index.js +10 -0
  171. package/dist/reporters/index.js.map +1 -0
  172. package/dist/reporters/json.cjs +215 -0
  173. package/dist/reporters/json.cjs.map +1 -0
  174. package/dist/reporters/json.d.cts +79 -0
  175. package/dist/reporters/json.d.cts.map +1 -0
  176. package/dist/reporters/json.d.ts +79 -0
  177. package/dist/reporters/json.d.ts.map +1 -0
  178. package/dist/reporters/json.js +211 -0
  179. package/dist/reporters/json.js.map +1 -0
  180. package/dist/reporters/registry.cjs +255 -0
  181. package/dist/reporters/registry.cjs.map +1 -0
  182. package/dist/reporters/registry.d.cts +155 -0
  183. package/dist/reporters/registry.d.cts.map +1 -0
  184. package/dist/reporters/registry.d.ts +155 -0
  185. package/dist/reporters/registry.d.ts.map +1 -0
  186. package/dist/reporters/registry.js +249 -0
  187. package/dist/reporters/registry.js.map +1 -0
  188. package/dist/reporters/simple.cjs +328 -0
  189. package/dist/reporters/simple.cjs.map +1 -0
  190. package/dist/reporters/simple.d.cts +51 -0
  191. package/dist/reporters/simple.d.cts.map +1 -0
  192. package/dist/reporters/simple.d.ts +51 -0
  193. package/dist/reporters/simple.d.ts.map +1 -0
  194. package/dist/reporters/simple.js +321 -0
  195. package/dist/reporters/simple.js.map +1 -0
  196. package/dist/schema/modestbench-config.schema.json +162 -0
  197. package/dist/storage/history.cjs +456 -0
  198. package/dist/storage/history.cjs.map +1 -0
  199. package/dist/storage/history.d.cts +99 -0
  200. package/dist/storage/history.d.cts.map +1 -0
  201. package/dist/storage/history.d.ts +99 -0
  202. package/dist/storage/history.d.ts.map +1 -0
  203. package/dist/storage/history.js +452 -0
  204. package/dist/storage/history.js.map +1 -0
  205. package/dist/types/cli.cjs +21 -0
  206. package/dist/types/cli.cjs.map +1 -0
  207. package/dist/types/cli.d.cts +296 -0
  208. package/dist/types/cli.d.cts.map +1 -0
  209. package/dist/types/cli.d.ts +296 -0
  210. package/dist/types/cli.d.ts.map +1 -0
  211. package/dist/types/cli.js +18 -0
  212. package/dist/types/cli.js.map +1 -0
  213. package/dist/types/core.cjs +14 -0
  214. package/dist/types/core.cjs.map +1 -0
  215. package/dist/types/core.d.cts +380 -0
  216. package/dist/types/core.d.cts.map +1 -0
  217. package/dist/types/core.d.ts +380 -0
  218. package/dist/types/core.d.ts.map +1 -0
  219. package/dist/types/core.js +13 -0
  220. package/dist/types/core.js.map +1 -0
  221. package/dist/types/index.cjs +27 -0
  222. package/dist/types/index.cjs.map +1 -0
  223. package/dist/types/index.d.cts +11 -0
  224. package/dist/types/index.d.cts.map +1 -0
  225. package/dist/types/index.d.ts +11 -0
  226. package/dist/types/index.d.ts.map +1 -0
  227. package/dist/types/index.js +11 -0
  228. package/dist/types/index.js.map +1 -0
  229. package/dist/types/interfaces.cjs +10 -0
  230. package/dist/types/interfaces.cjs.map +1 -0
  231. package/dist/types/interfaces.d.cts +381 -0
  232. package/dist/types/interfaces.d.cts.map +1 -0
  233. package/dist/types/interfaces.d.ts +381 -0
  234. package/dist/types/interfaces.d.ts.map +1 -0
  235. package/dist/types/interfaces.js +9 -0
  236. package/dist/types/interfaces.js.map +1 -0
  237. package/dist/types/utility.cjs +92 -0
  238. package/dist/types/utility.cjs.map +1 -0
  239. package/dist/types/utility.d.cts +330 -0
  240. package/dist/types/utility.d.cts.map +1 -0
  241. package/dist/types/utility.d.ts +330 -0
  242. package/dist/types/utility.d.ts.map +1 -0
  243. package/dist/types/utility.js +78 -0
  244. package/dist/types/utility.js.map +1 -0
  245. package/package.json +211 -0
  246. package/src/bootstrap.ts +35 -0
  247. package/src/cli/commands/history.ts +569 -0
  248. package/src/cli/commands/init.ts +658 -0
  249. package/src/cli/commands/run.ts +346 -0
  250. package/src/cli/index.ts +642 -0
  251. package/src/config/manager.ts +387 -0
  252. package/src/config/schema.ts +188 -0
  253. package/src/constants.ts +21 -0
  254. package/src/core/benchmark-schema.ts +185 -0
  255. package/src/core/engine.ts +888 -0
  256. package/src/core/engines/accurate-engine.ts +408 -0
  257. package/src/core/engines/index.ts +16 -0
  258. package/src/core/engines/tinybench-engine.ts +335 -0
  259. package/src/core/error-manager.ts +372 -0
  260. package/src/core/loader.ts +324 -0
  261. package/src/core/stats-utils.ts +135 -0
  262. package/src/index.ts +46 -0
  263. package/src/progress/manager.ts +415 -0
  264. package/src/reporters/csv.ts +368 -0
  265. package/src/reporters/human.ts +707 -0
  266. package/src/reporters/index.ts +10 -0
  267. package/src/reporters/json.ts +302 -0
  268. package/src/reporters/registry.ts +349 -0
  269. package/src/reporters/simple.ts +459 -0
  270. package/src/storage/history.ts +600 -0
  271. package/src/types/cli.ts +312 -0
  272. package/src/types/core.ts +414 -0
  273. package/src/types/index.ts +18 -0
  274. package/src/types/interfaces.ts +451 -0
  275. package/src/types/utility.ts +446 -0
@@ -0,0 +1,414 @@
1
+ /**
2
+ * ModestBench Core Types
3
+ *
4
+ * Defines the fundamental data structures used throughout the ModestBench
5
+ * system. These types represent benchmark results, metadata, configuration, and
6
+ * system state.
7
+ *
8
+ * Note: BenchmarkDefinition, BenchmarkSuite, and BenchmarkTask types are
9
+ * derived from Zod schemas and re-exported from benchmark-schema.ts for type
10
+ * safety and consistency.
11
+ */
12
+
13
+ // Re-export schema-derived types
14
+ export type {
15
+ BenchmarkDefinition,
16
+ BenchmarkDefinitionInput,
17
+ BenchmarkSuite,
18
+ BenchmarkSuiteInput,
19
+ BenchmarkTask,
20
+ BenchmarkTaskInput,
21
+ } from '../core/benchmark-schema.js';
22
+
23
+ /**
24
+ * Benchmark file structure after parsing
25
+ */
26
+ export interface BenchmarkFile {
27
+ /** Raw file content */
28
+ readonly content: string;
29
+ /** Parsed exports from the file */
30
+ readonly exports: unknown;
31
+ /** Absolute path to the file */
32
+ readonly filePath: string;
33
+ /** File metadata */
34
+ readonly metadata: FileMetadata;
35
+ }
36
+
37
+ /**
38
+ * Represents a complete benchmark run across multiple files
39
+ */
40
+ export interface BenchmarkRun {
41
+ /** CI/CD information if available */
42
+ readonly ci?: CiInfo;
43
+ /** Configuration used for this run */
44
+ readonly config: ModestBenchConfig;
45
+ /** Total execution time for the entire run in milliseconds */
46
+ readonly duration: number;
47
+ /** Timestamp when run completed */
48
+ readonly endTime: Date;
49
+ /** Environment information */
50
+ readonly environment: EnvironmentInfo;
51
+ /** Results from all benchmark files */
52
+ readonly files: readonly FileResult[];
53
+ /** Git information if available */
54
+ readonly git?: GitInfo;
55
+ /** Unique identifier for this run */
56
+ readonly id: string;
57
+ /** Custom run-level metadata */
58
+ readonly metadata?: Record<string, unknown>;
59
+ /** Timestamp when run started */
60
+ readonly startTime: Date;
61
+ /** Summary statistics across all results */
62
+ readonly summary: RunSummary;
63
+ /** Run-level tags */
64
+ readonly tags?: string[];
65
+ }
66
+
67
+ /**
68
+ * CI/CD environment information
69
+ */
70
+ export interface CiInfo {
71
+ /** Branch being built */
72
+ readonly branch?: string;
73
+ /** Build/job number */
74
+ readonly buildNumber?: string;
75
+ /** Build URL */
76
+ readonly buildUrl?: string;
77
+ /** Commit being built */
78
+ readonly commit?: string;
79
+ /** Name of the CI provider */
80
+ readonly provider: string;
81
+ /** Pull request number */
82
+ readonly pullRequest?: string;
83
+ }
84
+
85
+ /**
86
+ * CPU information
87
+ */
88
+ export interface CpuInfo {
89
+ /** Number of CPU cores */
90
+ readonly cores: number;
91
+ /** CPU model name */
92
+ readonly model: string;
93
+ /** CPU speed in MHz */
94
+ readonly speed: number;
95
+ }
96
+
97
+ /**
98
+ * Environment information captured during benchmark execution
99
+ */
100
+ export interface EnvironmentInfo {
101
+ /** Operating system architecture */
102
+ readonly arch: string;
103
+ /** Available memory at start of run */
104
+ readonly availableMemory: number;
105
+ /** CPU information */
106
+ readonly cpu: CpuInfo;
107
+ /** Environment variables related to benchmarking */
108
+ readonly env: Record<string, string>;
109
+ /** Hostname where benchmarks were executed */
110
+ readonly hostname: string;
111
+ /** Memory information */
112
+ readonly memory: MemoryInfo;
113
+ /** Node.js version */
114
+ readonly nodeVersion: string;
115
+ /** Operating system platform */
116
+ readonly platform: string;
117
+ }
118
+
119
+ /**
120
+ * Context information for errors
121
+ */
122
+ export interface ErrorContext {
123
+ /** File being processed when error occurred */
124
+ readonly file?: string;
125
+ /** Additional context data */
126
+ readonly metadata?: Record<string, unknown>;
127
+ /** Execution phase where error occurred */
128
+ readonly phase: ExecutionPhase;
129
+ /** Suite being executed when error occurred */
130
+ readonly suite?: string;
131
+ /** Task being executed when error occurred */
132
+ readonly task?: string;
133
+ /** Timestamp when error occurred */
134
+ readonly timestamp: Date;
135
+ }
136
+
137
+ /**
138
+ * Error statistics for tracking
139
+ */
140
+ export interface ErrorStats {
141
+ /** Errors grouped by execution phase */
142
+ readonly byPhase: Record<ExecutionPhase, number>;
143
+ /** Errors grouped by error type */
144
+ readonly byType: Record<string, number>;
145
+ /** First error timestamp */
146
+ readonly firstError?: Date;
147
+ /** Last error timestamp */
148
+ readonly lastError?: Date;
149
+ /** Recent errors (limited list) */
150
+ readonly recent: readonly ExecutionError[];
151
+ /** Total number of errors */
152
+ readonly total: number;
153
+ }
154
+
155
+ /**
156
+ * Structured execution error with context
157
+ */
158
+ export interface ExecutionError {
159
+ /** Error code for programmatic handling */
160
+ readonly code: string;
161
+ /** Error context information */
162
+ readonly context: ErrorContext;
163
+ /** Human-readable error message */
164
+ readonly message: string;
165
+ /** Original error object */
166
+ readonly originalError: Error;
167
+ /** Timestamp when error was processed */
168
+ readonly processedAt: Date;
169
+ /** Whether the error is recoverable */
170
+ readonly recoverable: boolean;
171
+ /** Stack trace */
172
+ readonly stack?: string;
173
+ }
174
+
175
+ /**
176
+ * Execution phases for error context
177
+ */
178
+ export type ExecutionPhase =
179
+ | 'cleanup'
180
+ | 'discovery'
181
+ | 'execution'
182
+ | 'loading'
183
+ | 'reporting'
184
+ | 'setup'
185
+ | 'teardown'
186
+ | 'validation';
187
+
188
+ /**
189
+ * File metadata for change detection and validation
190
+ */
191
+ export interface FileMetadata {
192
+ /** Names of all exports in the file */
193
+ readonly exportNames: string[];
194
+ /** Whether the file has a default export */
195
+ readonly hasDefaultExport: boolean;
196
+ /** File modification time */
197
+ readonly mtime: Date;
198
+ /** File size in bytes */
199
+ readonly size: number;
200
+ }
201
+
202
+ /**
203
+ * Represents results from a benchmark file (collection of suites)
204
+ */
205
+ export interface FileResult {
206
+ /** File-level configuration that was applied */
207
+ readonly config?: Partial<ModestBenchConfig> | undefined;
208
+ /** Total execution time for the file in milliseconds */
209
+ readonly duration: number;
210
+ /** Timestamp when file execution completed */
211
+ readonly endTime: Date;
212
+ /** Any file-level errors */
213
+ readonly error?: Error;
214
+ /** Absolute path to the benchmark file */
215
+ readonly filePath: string;
216
+ /** Timestamp when file execution started */
217
+ readonly startTime: Date;
218
+ /** Results from all suites in the file */
219
+ readonly suites: readonly SuiteResult[];
220
+ }
221
+
222
+ /**
223
+ * Git repository information
224
+ */
225
+ export interface GitInfo {
226
+ /** Author of the commit */
227
+ readonly author: string;
228
+ /** Current branch name */
229
+ readonly branch: string;
230
+ /** Current commit hash */
231
+ readonly commit: string;
232
+ /** Whether working directory has uncommitted changes */
233
+ readonly dirty: boolean;
234
+ /** Commit message */
235
+ readonly message: string;
236
+ /** List of modified files */
237
+ readonly modifiedFiles: string[];
238
+ /** Remote origin URL */
239
+ readonly remoteUrl?: string;
240
+ /** Commit timestamp */
241
+ readonly timestamp: Date;
242
+ }
243
+
244
+ /**
245
+ * Memory information
246
+ */
247
+ export interface MemoryInfo {
248
+ /** Free system memory in bytes */
249
+ readonly free: number;
250
+ /** Total system memory in bytes */
251
+ readonly total: number;
252
+ /** Used system memory in bytes */
253
+ readonly used: number;
254
+ }
255
+
256
+ /**
257
+ * Benchmark configuration
258
+ *
259
+ * The JSON Schema for this configuration is available at
260
+ * `dist/schema/modestbench-config.schema.json` after building the project.
261
+ *
262
+ * Config files can optionally include a `$schema` property pointing to the
263
+ * schema file for IDE autocomplete and validation support.
264
+ *
265
+ * @example
266
+ *
267
+ * ```json
268
+ * {
269
+ * "$schema": "./node_modules/modestbench/dist/schema/modestbench-config.schema.json",
270
+ * "iterations": 1000,
271
+ * "reporters": ["human", "json"],
272
+ * "time": 5000
273
+ * }
274
+ * ```
275
+ */
276
+ export interface ModestBenchConfig {
277
+ readonly $schema?: string | undefined;
278
+ /** Whether to stop on first failure */
279
+ readonly bail: boolean;
280
+ /** Patterns to exclude from discovery */
281
+ readonly exclude: string[];
282
+ /** Tags to exclude from execution */
283
+ readonly excludeTags: string[];
284
+ /** Default number of iterations per task */
285
+ readonly iterations: number;
286
+ /** How to limit benchmark execution: 'time', 'iterations', 'any', or 'all' */
287
+ readonly limitBy: 'all' | 'any' | 'iterations' | 'time';
288
+ /** Custom metadata to attach to runs */
289
+ readonly metadata: Record<string, unknown>;
290
+ /** Output directory for reports */
291
+ readonly outputDir: string;
292
+ /** Pattern(s) for discovering benchmark files */
293
+ readonly pattern: string | string[];
294
+ /** Whether to run in quiet mode */
295
+ readonly quiet: boolean;
296
+ /** Configuration for specific reporters */
297
+ readonly reporterConfig: Record<string, unknown>;
298
+ /** Reporters to use for output */
299
+ readonly reporters: string[];
300
+ /** Tags to include (if empty, include all) */
301
+ readonly tags: string[];
302
+ /** Threshold configuration for performance assertions */
303
+ readonly thresholds: ThresholdConfig;
304
+ /** Maximum time to spend on each task in milliseconds */
305
+ readonly time: number;
306
+ /** Timeout for individual tasks in milliseconds */
307
+ readonly timeout: number;
308
+ /** Whether to run in verbose mode */
309
+ readonly verbose: boolean;
310
+ /** Number of warmup iterations before measurement */
311
+ readonly warmup: number;
312
+ }
313
+
314
+ /**
315
+ * Summary statistics for a benchmark run
316
+ */
317
+ export interface RunSummary {
318
+ /** Number of tasks that failed */
319
+ readonly failedTasks: number;
320
+ /** Fastest task result */
321
+ readonly fastest: null | TaskResult;
322
+ /** Overall mean execution time across all tasks */
323
+ readonly overallMean: number;
324
+ /** Number of tasks that passed */
325
+ readonly passedTasks: number;
326
+ /** Slowest task result */
327
+ readonly slowest: null | TaskResult;
328
+ /** Total number of files executed */
329
+ readonly totalFiles: number;
330
+ /** Total number of operations performed */
331
+ readonly totalOperations: number;
332
+ /** Total number of suites executed */
333
+ readonly totalSuites: number;
334
+ /** Total number of tasks executed */
335
+ readonly totalTasks: number;
336
+ }
337
+
338
+ /**
339
+ * Represents results from a benchmark suite (collection of tasks)
340
+ */
341
+ export interface SuiteResult {
342
+ /** Suite-level configuration that was applied */
343
+ readonly config?: Partial<ModestBenchConfig>;
344
+ /** Total execution time for the suite in milliseconds */
345
+ readonly duration: number;
346
+ /** Timestamp when suite execution completed */
347
+ readonly endTime: Date;
348
+ /** Any suite-level errors */
349
+ readonly error?: Error;
350
+ /** Custom metadata for the suite */
351
+ readonly metadata?: Record<string, unknown>;
352
+ /** Name of the benchmark suite */
353
+ readonly name: string;
354
+ /** Timestamp when suite execution started */
355
+ readonly startTime: Date;
356
+ /** Suite-specific tags */
357
+ readonly tags?: string[];
358
+ /** Results for all tasks in the suite */
359
+ readonly tasks: readonly TaskResult[];
360
+ }
361
+
362
+ /**
363
+ * Represents a single benchmark task execution result
364
+ */
365
+ export interface TaskResult {
366
+ /** Coefficient of variation (stdDev/mean × 100) */
367
+ readonly cv: number;
368
+ /** Any error that occurred during execution */
369
+ readonly error?: Error;
370
+ /** Number of iterations executed */
371
+ readonly iterations: number;
372
+ /** Margin of error as a percentage */
373
+ readonly marginOfError: number;
374
+ /** Maximum execution time in nanoseconds */
375
+ readonly max: number;
376
+ /** Mean execution time in nanoseconds */
377
+ readonly mean: number;
378
+ /** Custom metadata associated with the task */
379
+ readonly metadata?: Record<string, unknown>;
380
+ /** Minimum execution time in nanoseconds */
381
+ readonly min: number;
382
+ /** Unique identifier for the task */
383
+ readonly name: string;
384
+ /** Operations per second (calculated from mean) */
385
+ readonly opsPerSecond: number;
386
+ /** 95th percentile execution time in nanoseconds */
387
+ readonly p95: number;
388
+ /** 99th percentile execution time in nanoseconds */
389
+ readonly p99: number;
390
+ /** Standard deviation of execution times in nanoseconds */
391
+ readonly stdDev: number;
392
+ /** Task-specific tags for filtering and grouping */
393
+ readonly tags?: string[];
394
+ /** Statistical variance of execution times */
395
+ readonly variance: number;
396
+ }
397
+
398
+ /**
399
+ * Threshold configuration for performance assertions
400
+ */
401
+ export interface ThresholdConfig {
402
+ /** Maximum allowed margin of error percentage */
403
+ readonly maxMarginOfError?: number;
404
+ /** Maximum allowed mean execution time in nanoseconds */
405
+ readonly maxMean?: number;
406
+ /** Maximum allowed 95th percentile time */
407
+ readonly maxP95?: number;
408
+ /** Maximum allowed 99th percentile time */
409
+ readonly maxP99?: number;
410
+ /** Maximum allowed standard deviation */
411
+ readonly maxStdDev?: number;
412
+ /** Minimum required operations per second */
413
+ readonly minOpsPerSecond?: number;
414
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * ModestBench Types Index
3
+ *
4
+ * Main entry point for all TypeScript type definitions used in ModestBench.
5
+ * This file re-exports all types from the individual type modules.
6
+ */
7
+
8
+ // CLI-specific types
9
+ export * from './cli.js';
10
+
11
+ // Core data types
12
+ export type * from './core.js';
13
+
14
+ // Interface contracts
15
+ export type * from './interfaces.js';
16
+
17
+ // Utility types and helpers
18
+ export * from './utility.js';