modestbench 0.2.0 → 0.3.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 (357) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +131 -34
  3. package/dist/cli/commands/analyze.cjs +60 -0
  4. package/dist/cli/commands/analyze.cjs.map +1 -0
  5. package/dist/cli/commands/analyze.d.cts +35 -0
  6. package/dist/cli/commands/analyze.d.cts.map +1 -0
  7. package/dist/cli/commands/analyze.d.ts +35 -0
  8. package/dist/cli/commands/analyze.d.ts.map +1 -0
  9. package/dist/cli/commands/analyze.js +56 -0
  10. package/dist/cli/commands/analyze.js.map +1 -0
  11. package/dist/cli/commands/baseline.cjs +404 -0
  12. package/dist/cli/commands/baseline.cjs.map +1 -0
  13. package/dist/cli/commands/baseline.d.cts +72 -0
  14. package/dist/cli/commands/baseline.d.cts.map +1 -0
  15. package/dist/cli/commands/baseline.d.ts +72 -0
  16. package/dist/cli/commands/baseline.d.ts.map +1 -0
  17. package/dist/cli/commands/baseline.js +396 -0
  18. package/dist/cli/commands/baseline.js.map +1 -0
  19. package/dist/cli/commands/history.d.cts +1 -1
  20. package/dist/cli/commands/history.d.cts.map +1 -1
  21. package/dist/cli/commands/history.d.ts +1 -1
  22. package/dist/cli/commands/history.d.ts.map +1 -1
  23. package/dist/cli/commands/init.cjs +99 -166
  24. package/dist/cli/commands/init.cjs.map +1 -1
  25. package/dist/cli/commands/init.d.cts +4 -4
  26. package/dist/cli/commands/init.d.cts.map +1 -1
  27. package/dist/cli/commands/init.d.ts +4 -4
  28. package/dist/cli/commands/init.d.ts.map +1 -1
  29. package/dist/cli/commands/init.js +99 -166
  30. package/dist/cli/commands/init.js.map +1 -1
  31. package/dist/cli/commands/run.cjs +146 -127
  32. package/dist/cli/commands/run.cjs.map +1 -1
  33. package/dist/cli/commands/run.d.cts +16 -3
  34. package/dist/cli/commands/run.d.cts.map +1 -1
  35. package/dist/cli/commands/run.d.ts +16 -3
  36. package/dist/cli/commands/run.d.ts.map +1 -1
  37. package/dist/cli/commands/run.js +145 -93
  38. package/dist/cli/commands/run.js.map +1 -1
  39. package/dist/cli/index.cjs +583 -394
  40. package/dist/cli/index.cjs.map +1 -1
  41. package/dist/cli/index.d.cts +4 -16
  42. package/dist/cli/index.d.cts.map +1 -1
  43. package/dist/cli/index.d.ts +4 -16
  44. package/dist/cli/index.d.ts.map +1 -1
  45. package/dist/cli/index.js +575 -386
  46. package/dist/cli/index.js.map +1 -1
  47. package/dist/config/budget-schema.cjs +172 -0
  48. package/dist/config/budget-schema.cjs.map +1 -0
  49. package/dist/config/budget-schema.d.cts +59 -0
  50. package/dist/config/budget-schema.d.cts.map +1 -0
  51. package/dist/config/budget-schema.d.ts +59 -0
  52. package/dist/config/budget-schema.d.ts.map +1 -0
  53. package/dist/config/budget-schema.js +166 -0
  54. package/dist/config/budget-schema.js.map +1 -0
  55. package/dist/config/schema.cjs +182 -2
  56. package/dist/config/schema.cjs.map +1 -1
  57. package/dist/config/schema.d.cts +122 -3
  58. package/dist/config/schema.d.cts.map +1 -1
  59. package/dist/config/schema.d.ts +122 -3
  60. package/dist/config/schema.d.ts.map +1 -1
  61. package/dist/config/schema.js +180 -1
  62. package/dist/config/schema.js.map +1 -1
  63. package/dist/constants.cjs +45 -2
  64. package/dist/constants.cjs.map +1 -1
  65. package/dist/constants.d.cts +41 -0
  66. package/dist/constants.d.cts.map +1 -1
  67. package/dist/constants.d.ts +41 -0
  68. package/dist/constants.d.ts.map +1 -1
  69. package/dist/constants.js +44 -1
  70. package/dist/constants.js.map +1 -1
  71. package/dist/core/engine.cjs +114 -23
  72. package/dist/core/engine.cjs.map +1 -1
  73. package/dist/core/engine.d.cts +7 -7
  74. package/dist/core/engine.d.cts.map +1 -1
  75. package/dist/core/engine.d.ts +7 -7
  76. package/dist/core/engine.d.ts.map +1 -1
  77. package/dist/core/engine.js +115 -24
  78. package/dist/core/engine.js.map +1 -1
  79. package/dist/core/engines/accurate-engine.cjs +171 -36
  80. package/dist/core/engines/accurate-engine.cjs.map +1 -1
  81. package/dist/core/engines/accurate-engine.d.cts +5 -0
  82. package/dist/core/engines/accurate-engine.d.cts.map +1 -1
  83. package/dist/core/engines/accurate-engine.d.ts +5 -0
  84. package/dist/core/engines/accurate-engine.d.ts.map +1 -1
  85. package/dist/core/engines/accurate-engine.js +171 -36
  86. package/dist/core/engines/accurate-engine.js.map +1 -1
  87. package/dist/core/engines/tinybench-engine.cjs +3 -2
  88. package/dist/core/engines/tinybench-engine.cjs.map +1 -1
  89. package/dist/core/engines/tinybench-engine.d.cts.map +1 -1
  90. package/dist/core/engines/tinybench-engine.d.ts.map +1 -1
  91. package/dist/core/engines/tinybench-engine.js +3 -2
  92. package/dist/core/engines/tinybench-engine.js.map +1 -1
  93. package/dist/core/output-path-resolver.cjs +8 -1
  94. package/dist/core/output-path-resolver.cjs.map +1 -1
  95. package/dist/core/output-path-resolver.d.cts.map +1 -1
  96. package/dist/core/output-path-resolver.d.ts.map +1 -1
  97. package/dist/core/output-path-resolver.js +9 -2
  98. package/dist/core/output-path-resolver.js.map +1 -1
  99. package/dist/errors/base.cjs +12 -3
  100. package/dist/errors/base.cjs.map +1 -1
  101. package/dist/errors/base.d.cts +7 -0
  102. package/dist/errors/base.d.cts.map +1 -1
  103. package/dist/errors/base.d.ts +7 -0
  104. package/dist/errors/base.d.ts.map +1 -1
  105. package/dist/errors/base.js +10 -2
  106. package/dist/errors/base.js.map +1 -1
  107. package/dist/errors/budget.cjs +37 -0
  108. package/dist/errors/budget.cjs.map +1 -0
  109. package/dist/errors/budget.d.cts +31 -0
  110. package/dist/errors/budget.d.cts.map +1 -0
  111. package/dist/errors/budget.d.ts +31 -0
  112. package/dist/errors/budget.d.ts.map +1 -0
  113. package/dist/errors/budget.js +33 -0
  114. package/dist/errors/budget.js.map +1 -0
  115. package/dist/errors/index.cjs +4 -1
  116. package/dist/errors/index.cjs.map +1 -1
  117. package/dist/errors/index.d.cts +1 -0
  118. package/dist/errors/index.d.cts.map +1 -1
  119. package/dist/errors/index.d.ts +1 -0
  120. package/dist/errors/index.d.ts.map +1 -1
  121. package/dist/errors/index.js +2 -0
  122. package/dist/errors/index.js.map +1 -1
  123. package/dist/index.cjs +13 -1
  124. package/dist/index.cjs.map +1 -1
  125. package/dist/index.d.cts +5 -0
  126. package/dist/index.d.cts.map +1 -1
  127. package/dist/index.d.ts +5 -0
  128. package/dist/index.d.ts.map +1 -1
  129. package/dist/index.js +7 -0
  130. package/dist/index.js.map +1 -1
  131. package/dist/reporters/csv.cjs +37 -17
  132. package/dist/reporters/csv.cjs.map +1 -1
  133. package/dist/reporters/csv.d.cts +3 -6
  134. package/dist/reporters/csv.d.cts.map +1 -1
  135. package/dist/reporters/csv.d.ts +3 -6
  136. package/dist/reporters/csv.d.ts.map +1 -1
  137. package/dist/reporters/csv.js +37 -17
  138. package/dist/reporters/csv.js.map +1 -1
  139. package/dist/reporters/human.cjs +290 -67
  140. package/dist/reporters/human.cjs.map +1 -1
  141. package/dist/reporters/human.d.cts +25 -13
  142. package/dist/reporters/human.d.cts.map +1 -1
  143. package/dist/reporters/human.d.ts +25 -13
  144. package/dist/reporters/human.d.ts.map +1 -1
  145. package/dist/reporters/human.js +290 -67
  146. package/dist/reporters/human.js.map +1 -1
  147. package/dist/reporters/json.cjs +23 -48
  148. package/dist/reporters/json.cjs.map +1 -1
  149. package/dist/reporters/json.d.cts +2 -28
  150. package/dist/reporters/json.d.cts.map +1 -1
  151. package/dist/reporters/json.d.ts +2 -28
  152. package/dist/reporters/json.d.ts.map +1 -1
  153. package/dist/reporters/json.js +25 -50
  154. package/dist/reporters/json.js.map +1 -1
  155. package/dist/reporters/profile-human.cjs +154 -0
  156. package/dist/reporters/profile-human.cjs.map +1 -0
  157. package/dist/reporters/profile-human.d.cts +44 -0
  158. package/dist/reporters/profile-human.d.cts.map +1 -0
  159. package/dist/reporters/profile-human.d.ts +44 -0
  160. package/dist/reporters/profile-human.d.ts.map +1 -0
  161. package/dist/reporters/profile-human.js +147 -0
  162. package/dist/reporters/profile-human.js.map +1 -0
  163. package/dist/reporters/simple.cjs +67 -45
  164. package/dist/reporters/simple.cjs.map +1 -1
  165. package/dist/reporters/simple.d.cts +14 -14
  166. package/dist/reporters/simple.d.cts.map +1 -1
  167. package/dist/reporters/simple.d.ts +14 -14
  168. package/dist/reporters/simple.d.ts.map +1 -1
  169. package/dist/reporters/simple.js +67 -45
  170. package/dist/reporters/simple.js.map +1 -1
  171. package/dist/schema/modestbench-config.schema.json +153 -0
  172. package/dist/services/baseline-storage.cjs +151 -0
  173. package/dist/services/baseline-storage.cjs.map +1 -0
  174. package/dist/services/baseline-storage.d.cts +55 -0
  175. package/dist/services/baseline-storage.d.cts.map +1 -0
  176. package/dist/services/baseline-storage.d.ts +55 -0
  177. package/dist/services/baseline-storage.d.ts.map +1 -0
  178. package/dist/services/baseline-storage.js +147 -0
  179. package/dist/services/baseline-storage.js.map +1 -0
  180. package/dist/services/budget-evaluator.cjs +146 -0
  181. package/dist/services/budget-evaluator.cjs.map +1 -0
  182. package/dist/services/budget-evaluator.d.cts +29 -0
  183. package/dist/services/budget-evaluator.d.cts.map +1 -0
  184. package/dist/services/budget-evaluator.d.ts +29 -0
  185. package/dist/services/budget-evaluator.d.ts.map +1 -0
  186. package/dist/services/budget-evaluator.js +142 -0
  187. package/dist/services/budget-evaluator.js.map +1 -0
  188. package/dist/services/config-manager.cjs +24 -10
  189. package/dist/services/config-manager.cjs.map +1 -1
  190. package/dist/services/config-manager.d.cts +6 -1
  191. package/dist/services/config-manager.d.cts.map +1 -1
  192. package/dist/services/config-manager.d.ts +6 -1
  193. package/dist/services/config-manager.d.ts.map +1 -1
  194. package/dist/services/config-manager.js +24 -10
  195. package/dist/services/config-manager.js.map +1 -1
  196. package/dist/services/file-loader.cjs +3 -6
  197. package/dist/services/file-loader.cjs.map +1 -1
  198. package/dist/services/file-loader.d.cts.map +1 -1
  199. package/dist/services/file-loader.d.ts.map +1 -1
  200. package/dist/services/file-loader.js +3 -6
  201. package/dist/services/file-loader.js.map +1 -1
  202. package/dist/services/profiler/profile-filter.cjs +116 -0
  203. package/dist/services/profiler/profile-filter.cjs.map +1 -0
  204. package/dist/services/profiler/profile-filter.d.cts +20 -0
  205. package/dist/services/profiler/profile-filter.d.cts.map +1 -0
  206. package/dist/services/profiler/profile-filter.d.ts +20 -0
  207. package/dist/services/profiler/profile-filter.d.ts.map +1 -0
  208. package/dist/services/profiler/profile-filter.js +112 -0
  209. package/dist/services/profiler/profile-filter.js.map +1 -0
  210. package/dist/services/profiler/profile-parser.cjs +139 -0
  211. package/dist/services/profiler/profile-parser.cjs.map +1 -0
  212. package/dist/services/profiler/profile-parser.d.cts +18 -0
  213. package/dist/services/profiler/profile-parser.d.cts.map +1 -0
  214. package/dist/services/profiler/profile-parser.d.ts +18 -0
  215. package/dist/services/profiler/profile-parser.d.ts.map +1 -0
  216. package/dist/services/profiler/profile-parser.js +132 -0
  217. package/dist/services/profiler/profile-parser.js.map +1 -0
  218. package/dist/services/profiler/profile-runner.cjs +90 -0
  219. package/dist/services/profiler/profile-runner.cjs.map +1 -0
  220. package/dist/services/profiler/profile-runner.d.cts +29 -0
  221. package/dist/services/profiler/profile-runner.d.cts.map +1 -0
  222. package/dist/services/profiler/profile-runner.d.ts +29 -0
  223. package/dist/services/profiler/profile-runner.d.ts.map +1 -0
  224. package/dist/services/profiler/profile-runner.js +86 -0
  225. package/dist/services/profiler/profile-runner.js.map +1 -0
  226. package/dist/services/progress-manager.cjs +10 -2
  227. package/dist/services/progress-manager.cjs.map +1 -1
  228. package/dist/services/progress-manager.d.cts +2 -0
  229. package/dist/services/progress-manager.d.cts.map +1 -1
  230. package/dist/services/progress-manager.d.ts +2 -0
  231. package/dist/services/progress-manager.d.ts.map +1 -1
  232. package/dist/services/progress-manager.js +10 -2
  233. package/dist/services/progress-manager.js.map +1 -1
  234. package/dist/services/reporter-registry.cjs +18 -24
  235. package/dist/services/reporter-registry.cjs.map +1 -1
  236. package/dist/services/reporter-registry.d.cts +18 -40
  237. package/dist/services/reporter-registry.d.cts.map +1 -1
  238. package/dist/services/reporter-registry.d.ts +18 -40
  239. package/dist/services/reporter-registry.d.ts.map +1 -1
  240. package/dist/services/reporter-registry.js +18 -24
  241. package/dist/services/reporter-registry.js.map +1 -1
  242. package/dist/types/budgets.cjs +8 -0
  243. package/dist/types/budgets.cjs.map +1 -0
  244. package/dist/types/budgets.d.cts +149 -0
  245. package/dist/types/budgets.d.cts.map +1 -0
  246. package/dist/types/budgets.d.ts +149 -0
  247. package/dist/types/budgets.d.ts.map +1 -0
  248. package/dist/types/budgets.js +7 -0
  249. package/dist/types/budgets.js.map +1 -0
  250. package/dist/types/cli.cjs +2 -11
  251. package/dist/types/cli.cjs.map +1 -1
  252. package/dist/types/cli.d.cts +3 -227
  253. package/dist/types/cli.d.cts.map +1 -1
  254. package/dist/types/cli.d.ts +3 -227
  255. package/dist/types/cli.d.ts.map +1 -1
  256. package/dist/types/cli.js +2 -11
  257. package/dist/types/cli.js.map +1 -1
  258. package/dist/types/core.cjs +6 -1
  259. package/dist/types/core.cjs.map +1 -1
  260. package/dist/types/core.d.cts +15 -2
  261. package/dist/types/core.d.cts.map +1 -1
  262. package/dist/types/core.d.ts +15 -2
  263. package/dist/types/core.d.ts.map +1 -1
  264. package/dist/types/core.js +2 -1
  265. package/dist/types/core.js.map +1 -1
  266. package/dist/types/index.cjs +5 -0
  267. package/dist/types/index.cjs.map +1 -1
  268. package/dist/types/index.d.cts +2 -0
  269. package/dist/types/index.d.cts.map +1 -1
  270. package/dist/types/index.d.ts +2 -0
  271. package/dist/types/index.d.ts.map +1 -1
  272. package/dist/types/index.js +2 -0
  273. package/dist/types/index.js.map +1 -1
  274. package/dist/types/interfaces.d.cts +19 -8
  275. package/dist/types/interfaces.d.cts.map +1 -1
  276. package/dist/types/interfaces.d.ts +19 -8
  277. package/dist/types/interfaces.d.ts.map +1 -1
  278. package/dist/types/profiler.cjs +11 -0
  279. package/dist/types/profiler.cjs.map +1 -0
  280. package/dist/types/profiler.d.cts +102 -0
  281. package/dist/types/profiler.d.cts.map +1 -0
  282. package/dist/types/profiler.d.ts +102 -0
  283. package/dist/types/profiler.d.ts.map +1 -0
  284. package/dist/types/profiler.js +10 -0
  285. package/dist/types/profiler.js.map +1 -0
  286. package/dist/types/utility.cjs.map +1 -1
  287. package/dist/types/utility.d.cts +0 -8
  288. package/dist/types/utility.d.cts.map +1 -1
  289. package/dist/types/utility.d.ts +0 -8
  290. package/dist/types/utility.d.ts.map +1 -1
  291. package/dist/types/utility.js.map +1 -1
  292. package/dist/utils/identifiers.cjs +32 -0
  293. package/dist/utils/identifiers.cjs.map +1 -0
  294. package/dist/utils/identifiers.d.cts +32 -0
  295. package/dist/utils/identifiers.d.cts.map +1 -0
  296. package/dist/utils/identifiers.d.ts +32 -0
  297. package/dist/utils/identifiers.d.ts.map +1 -0
  298. package/dist/utils/identifiers.js +27 -0
  299. package/dist/utils/identifiers.js.map +1 -0
  300. package/dist/utils/package.cjs +40 -0
  301. package/dist/utils/package.cjs.map +1 -0
  302. package/dist/utils/package.d.cts +15 -0
  303. package/dist/utils/package.d.cts.map +1 -0
  304. package/dist/utils/package.d.ts +15 -0
  305. package/dist/utils/package.d.ts.map +1 -0
  306. package/dist/utils/package.js +33 -0
  307. package/dist/utils/package.js.map +1 -0
  308. package/dist/utils/type-guards.cjs +48 -0
  309. package/dist/utils/type-guards.cjs.map +1 -0
  310. package/dist/utils/type-guards.d.cts +22 -0
  311. package/dist/utils/type-guards.d.cts.map +1 -0
  312. package/dist/utils/type-guards.d.ts +22 -0
  313. package/dist/utils/type-guards.d.ts.map +1 -0
  314. package/dist/utils/type-guards.js +43 -0
  315. package/dist/utils/type-guards.js.map +1 -0
  316. package/package.json +18 -19
  317. package/src/cli/commands/analyze.ts +101 -0
  318. package/src/cli/commands/baseline.ts +577 -0
  319. package/src/cli/commands/history.ts +1 -1
  320. package/src/cli/commands/init.ts +116 -194
  321. package/src/cli/commands/run.ts +183 -113
  322. package/src/cli/index.ts +425 -183
  323. package/src/config/budget-schema.ts +189 -0
  324. package/src/config/schema.ts +260 -1
  325. package/src/constants.ts +53 -1
  326. package/src/core/engine.ts +169 -22
  327. package/src/core/engines/accurate-engine.ts +195 -44
  328. package/src/core/engines/tinybench-engine.ts +3 -2
  329. package/src/core/output-path-resolver.ts +10 -2
  330. package/src/errors/base.ts +11 -2
  331. package/src/errors/budget.ts +38 -0
  332. package/src/errors/index.ts +3 -0
  333. package/src/index.ts +9 -0
  334. package/src/reporters/csv.ts +54 -25
  335. package/src/reporters/human.ts +434 -115
  336. package/src/reporters/json.ts +26 -71
  337. package/src/reporters/profile-human.ts +210 -0
  338. package/src/reporters/simple.ts +88 -54
  339. package/src/services/baseline-storage.ts +199 -0
  340. package/src/services/budget-evaluator.ts +182 -0
  341. package/src/services/config-manager.ts +24 -9
  342. package/src/services/file-loader.ts +3 -6
  343. package/src/services/profiler/profile-filter.ts +147 -0
  344. package/src/services/profiler/profile-parser.ts +194 -0
  345. package/src/services/profiler/profile-runner.ts +121 -0
  346. package/src/services/progress-manager.ts +12 -2
  347. package/src/services/reporter-registry.ts +46 -81
  348. package/src/types/budgets.ts +180 -0
  349. package/src/types/cli.ts +5 -238
  350. package/src/types/core.ts +52 -10
  351. package/src/types/index.ts +5 -0
  352. package/src/types/interfaces.ts +24 -6
  353. package/src/types/profiler.ts +135 -0
  354. package/src/types/utility.ts +0 -10
  355. package/src/utils/identifiers.ts +58 -0
  356. package/src/utils/package.ts +35 -0
  357. package/src/utils/type-guards.ts +51 -0
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ /**
3
+ * Profile Human Reporter
4
+ *
5
+ * Human-readable reporter for profile command. Uses modestbench's synthwave
6
+ * ANSI theme to display profiled functions in an attractive, color-coded
7
+ * format.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ProfileHumanReporter = void 0;
16
+ const node_path_1 = __importDefault(require("node:path"));
17
+ const ansi_js_1 = require("../utils/ansi.cjs");
18
+ /**
19
+ * Human-readable profile reporter
20
+ */
21
+ class ProfileHumanReporter {
22
+ groupByFile;
23
+ useColor;
24
+ constructor(options = {}) {
25
+ this.useColor =
26
+ options.color ??
27
+ (process.stdout.isTTY &&
28
+ process.env.FORCE_COLOR !== '0' &&
29
+ process.env.NO_COLOR == null);
30
+ this.groupByFile = options.groupByFile ?? false;
31
+ }
32
+ /**
33
+ * Generate and print profile report
34
+ */
35
+ report(data) {
36
+ this.printHeader(data);
37
+ this.printLine();
38
+ if (this.groupByFile && data.groupedByFile) {
39
+ this.printGroupedResults(data);
40
+ }
41
+ else {
42
+ this.printFlatResults(data);
43
+ }
44
+ }
45
+ colorize(color, text) {
46
+ if (!this.useColor) {
47
+ return text;
48
+ }
49
+ return `${ansi_js_1.colors[color]}${text}${ansi_js_1.colors.reset}`;
50
+ }
51
+ /**
52
+ * Format file path - show relative path if within CWD, otherwise absolute
53
+ */
54
+ formatPath(filePath) {
55
+ const cwd = process.cwd();
56
+ const absolutePath = node_path_1.default.resolve(filePath);
57
+ // Check if the file is within the current working directory
58
+ if (absolutePath.startsWith(cwd + node_path_1.default.sep) || absolutePath === cwd) {
59
+ return node_path_1.default.relative(cwd, absolutePath);
60
+ }
61
+ return absolutePath;
62
+ }
63
+ getPercentColor(percent) {
64
+ if (percent >= 10) {
65
+ return 'brightRed';
66
+ }
67
+ if (percent >= 5) {
68
+ return 'brightYellow';
69
+ }
70
+ if (percent >= 2) {
71
+ return 'brightCyan';
72
+ }
73
+ return 'white';
74
+ }
75
+ printFlatResults(data) {
76
+ const header = `${this.colorize('magenta', ansi_js_1.ansiChars.block.full.repeat(2))} ${this.colorize('brightWhite', this.colorize('bold', 'Benchmark Candidates'))}`;
77
+ this.printLine(header);
78
+ this.printLine();
79
+ this.printLine('Top functions by execution time:');
80
+ this.printLine();
81
+ for (const fn of data.functions) {
82
+ // Function name and percentage
83
+ const percentColor = this.getPercentColor(fn.percentage);
84
+ const percent = `${fn.percentage.toFixed(1)}%`;
85
+ const ticks = `(${fn.ticks.toLocaleString()} ticks)`;
86
+ this.printLine(` ${this.colorize('brightWhite', fn.name).padEnd(60)} ${this.colorize(percentColor, percent.padStart(6))} ${this.colorize('dim', ticks)}`);
87
+ // File and line
88
+ const displayPath = this.formatPath(fn.file);
89
+ const lineInfo = fn.line ? `:${fn.line}` : '';
90
+ this.printLine(` ${this.colorize('brightMagenta', this.colorize('bold', displayPath + lineInfo))}`);
91
+ this.printLine();
92
+ }
93
+ this.printSummary(data);
94
+ }
95
+ printGroupedResults(data) {
96
+ if (!data.groupedByFile) {
97
+ return;
98
+ }
99
+ const header = `${this.colorize('magenta', ansi_js_1.ansiChars.block.full.repeat(2))} ${this.colorize('brightWhite', this.colorize('bold', 'Grouped by File'))}`;
100
+ this.printLine(header);
101
+ this.printLine();
102
+ // Sort files by total percentage
103
+ const sortedFiles = Array.from(data.groupedByFile.entries()).sort((a, b) => {
104
+ const aTotal = a[1].reduce((sum, fn) => sum + fn.percentage, 0);
105
+ const bTotal = b[1].reduce((sum, fn) => sum + fn.percentage, 0);
106
+ return bTotal - aTotal;
107
+ });
108
+ for (const [file, functions] of sortedFiles) {
109
+ const totalPercent = functions.reduce((sum, fn) => sum + fn.percentage, 0);
110
+ const totalTicks = functions.reduce((sum, fn) => sum + fn.ticks, 0);
111
+ const percentColor = this.getPercentColor(totalPercent);
112
+ const percent = `${totalPercent.toFixed(1)}%`;
113
+ const ticks = `(${totalTicks.toLocaleString()} ticks)`;
114
+ // File header
115
+ const displayPath = this.formatPath(file);
116
+ this.printLine(`${this.colorize('magenta', ansi_js_1.ansiChars.block.dark)} ${this.colorize('brightMagenta', this.colorize('bold', displayPath)).padEnd(60)} ${this.colorize(percentColor, percent.padStart(6))} ${this.colorize('dim', ticks)}`);
117
+ // Functions in this file
118
+ for (const fn of functions) {
119
+ const fnPercent = `${fn.percentage.toFixed(1)}%`;
120
+ const fnTicks = `(${fn.ticks.toLocaleString()} ticks)`;
121
+ const lineInfo = fn.line ? `:${fn.line}` : '';
122
+ this.printLine(` ${this.colorize('magenta', ansi_js_1.ansiChars.smallSquare)} ${this.colorize('brightWhite', fn.name).padEnd(58)} ${this.colorize(this.getPercentColor(fn.percentage), fnPercent.padStart(6))} ${this.colorize('dim', fnTicks.padEnd(15))} ${this.colorize('dim', lineInfo)}`);
123
+ }
124
+ this.printLine();
125
+ }
126
+ this.printSummary(data);
127
+ }
128
+ printHeader(data) {
129
+ const header = `${this.colorize('magenta', ansi_js_1.ansiChars.block.full.repeat(2))} ${this.colorize('brightWhite', this.colorize('bold', 'Profile Analysis'))}`;
130
+ this.printLine(header);
131
+ this.printLine();
132
+ if (data.command) {
133
+ this.printLine(`Command: ${this.colorize('cyan', data.command)}`);
134
+ }
135
+ if (data.duration) {
136
+ const durationSec = (data.duration / 1000).toFixed(1);
137
+ this.printLine(`Duration: ${this.colorize('cyan', `${durationSec}s`)}`);
138
+ }
139
+ this.printLine(`Total Ticks: ${this.colorize('cyan', data.totalTicks.toLocaleString())}`);
140
+ }
141
+ printLine(text = '') {
142
+ console.log(text);
143
+ }
144
+ printSummary(data) {
145
+ if (data.totalShown === 0) {
146
+ this.printLine(`${this.colorize('dim', `No functions used at least ${data.minExecutionPercent}% of the ticks`)}`);
147
+ }
148
+ else {
149
+ this.printLine(`${this.colorize('dim', `... (showing top ${data.totalShown} of ${data.totalFiltered} user functions)`)}`);
150
+ }
151
+ }
152
+ }
153
+ exports.ProfileHumanReporter = ProfileHumanReporter;
154
+ //# sourceMappingURL=profile-human.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-human.js","sourceRoot":"","sources":["../../src/reporters/profile-human.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;AAEH,0DAA6B;AAI7B,+CAAqD;AAarD;;GAEG;AACH,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gB,CAAC,EAAE,CAClG,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,SAAS,CACZ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,oBAAoB,IAAI,CAAC,UAAU,OAAO,IAAI,CAAC,aAAa,kBAAkB,CAAC,EAAE,CAC1G,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAnLD,oDAmLC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Profile Human Reporter
3
+ *
4
+ * Human-readable reporter for profile command. Uses modestbench's synthwave
5
+ * ANSI theme to display profiled functions in an attractive, color-coded
6
+ * format.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ import type { FilteredProfileData } from "../types/profiler.cjs";
11
+ /**
12
+ * Reporter options
13
+ */
14
+ interface ProfileReporterOptions {
15
+ /** Enable color output */
16
+ color?: boolean;
17
+ /** Group by file */
18
+ groupByFile?: boolean;
19
+ }
20
+ /**
21
+ * Human-readable profile reporter
22
+ */
23
+ export declare class ProfileHumanReporter {
24
+ private readonly groupByFile;
25
+ private readonly useColor;
26
+ constructor(options?: ProfileReporterOptions);
27
+ /**
28
+ * Generate and print profile report
29
+ */
30
+ report(data: FilteredProfileData): void;
31
+ private colorize;
32
+ /**
33
+ * Format file path - show relative path if within CWD, otherwise absolute
34
+ */
35
+ private formatPath;
36
+ private getPercentColor;
37
+ private printFlatResults;
38
+ private printGroupedResults;
39
+ private printHeader;
40
+ private printLine;
41
+ private printSummary;
42
+ }
43
+ export {};
44
+ //# sourceMappingURL=profile-human.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-human.d.ts","sourceRoot":"","sources":["../../src/reporters/profile-human.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,8BAA6B;AAIhE;;GAEG;AACH,UAAU,sBAAsB;IAC9B,0BAA0B;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,oBAAoB;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAU;IAEtC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;gBAEvB,OAAO,GAAE,sBAA2B;IAUhD;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI;IAWvC,OAAO,CAAC,QAAQ;IAOhB;;OAEG;IACH,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,gBAAgB;IA6BxB,OAAO,CAAC,mBAAmB;IAoD3B,OAAO,CAAC,WAAW;IAmBnB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,YAAY;CAWrB"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Profile Human Reporter
3
+ *
4
+ * Human-readable reporter for profile command. Uses modestbench's synthwave
5
+ * ANSI theme to display profiled functions in an attractive, color-coded
6
+ * format.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ import type { FilteredProfileData } from "../types/profiler.js";
11
+ /**
12
+ * Reporter options
13
+ */
14
+ interface ProfileReporterOptions {
15
+ /** Enable color output */
16
+ color?: boolean;
17
+ /** Group by file */
18
+ groupByFile?: boolean;
19
+ }
20
+ /**
21
+ * Human-readable profile reporter
22
+ */
23
+ export declare class ProfileHumanReporter {
24
+ private readonly groupByFile;
25
+ private readonly useColor;
26
+ constructor(options?: ProfileReporterOptions);
27
+ /**
28
+ * Generate and print profile report
29
+ */
30
+ report(data: FilteredProfileData): void;
31
+ private colorize;
32
+ /**
33
+ * Format file path - show relative path if within CWD, otherwise absolute
34
+ */
35
+ private formatPath;
36
+ private getPercentColor;
37
+ private printFlatResults;
38
+ private printGroupedResults;
39
+ private printHeader;
40
+ private printLine;
41
+ private printSummary;
42
+ }
43
+ export {};
44
+ //# sourceMappingURL=profile-human.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-human.d.ts","sourceRoot":"","sources":["../../src/reporters/profile-human.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,6BAA6B;AAIhE;;GAEG;AACH,UAAU,sBAAsB;IAC9B,0BAA0B;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,oBAAoB;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAU;IAEtC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;gBAEvB,OAAO,GAAE,sBAA2B;IAUhD;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI;IAWvC,OAAO,CAAC,QAAQ;IAOhB;;OAEG;IACH,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,gBAAgB;IA6BxB,OAAO,CAAC,mBAAmB;IAoD3B,OAAO,CAAC,WAAW;IAmBnB,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,YAAY;CAWrB"}
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Profile Human Reporter
3
+ *
4
+ * Human-readable reporter for profile command. Uses modestbench's synthwave
5
+ * ANSI theme to display profiled functions in an attractive, color-coded
6
+ * format.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ import path from 'node:path';
11
+ import { ansiChars, colors } from "../utils/ansi.js";
12
+ /**
13
+ * Human-readable profile reporter
14
+ */
15
+ export class ProfileHumanReporter {
16
+ groupByFile;
17
+ useColor;
18
+ constructor(options = {}) {
19
+ this.useColor =
20
+ options.color ??
21
+ (process.stdout.isTTY &&
22
+ process.env.FORCE_COLOR !== '0' &&
23
+ process.env.NO_COLOR == null);
24
+ this.groupByFile = options.groupByFile ?? false;
25
+ }
26
+ /**
27
+ * Generate and print profile report
28
+ */
29
+ report(data) {
30
+ this.printHeader(data);
31
+ this.printLine();
32
+ if (this.groupByFile && data.groupedByFile) {
33
+ this.printGroupedResults(data);
34
+ }
35
+ else {
36
+ this.printFlatResults(data);
37
+ }
38
+ }
39
+ colorize(color, text) {
40
+ if (!this.useColor) {
41
+ return text;
42
+ }
43
+ return `${colors[color]}${text}${colors.reset}`;
44
+ }
45
+ /**
46
+ * Format file path - show relative path if within CWD, otherwise absolute
47
+ */
48
+ formatPath(filePath) {
49
+ const cwd = process.cwd();
50
+ const absolutePath = path.resolve(filePath);
51
+ // Check if the file is within the current working directory
52
+ if (absolutePath.startsWith(cwd + path.sep) || absolutePath === cwd) {
53
+ return path.relative(cwd, absolutePath);
54
+ }
55
+ return absolutePath;
56
+ }
57
+ getPercentColor(percent) {
58
+ if (percent >= 10) {
59
+ return 'brightRed';
60
+ }
61
+ if (percent >= 5) {
62
+ return 'brightYellow';
63
+ }
64
+ if (percent >= 2) {
65
+ return 'brightCyan';
66
+ }
67
+ return 'white';
68
+ }
69
+ printFlatResults(data) {
70
+ const header = `${this.colorize('magenta', ansiChars.block.full.repeat(2))} ${this.colorize('brightWhite', this.colorize('bold', 'Benchmark Candidates'))}`;
71
+ this.printLine(header);
72
+ this.printLine();
73
+ this.printLine('Top functions by execution time:');
74
+ this.printLine();
75
+ for (const fn of data.functions) {
76
+ // Function name and percentage
77
+ const percentColor = this.getPercentColor(fn.percentage);
78
+ const percent = `${fn.percentage.toFixed(1)}%`;
79
+ const ticks = `(${fn.ticks.toLocaleString()} ticks)`;
80
+ this.printLine(` ${this.colorize('brightWhite', fn.name).padEnd(60)} ${this.colorize(percentColor, percent.padStart(6))} ${this.colorize('dim', ticks)}`);
81
+ // File and line
82
+ const displayPath = this.formatPath(fn.file);
83
+ const lineInfo = fn.line ? `:${fn.line}` : '';
84
+ this.printLine(` ${this.colorize('brightMagenta', this.colorize('bold', displayPath + lineInfo))}`);
85
+ this.printLine();
86
+ }
87
+ this.printSummary(data);
88
+ }
89
+ printGroupedResults(data) {
90
+ if (!data.groupedByFile) {
91
+ return;
92
+ }
93
+ const header = `${this.colorize('magenta', ansiChars.block.full.repeat(2))} ${this.colorize('brightWhite', this.colorize('bold', 'Grouped by File'))}`;
94
+ this.printLine(header);
95
+ this.printLine();
96
+ // Sort files by total percentage
97
+ const sortedFiles = Array.from(data.groupedByFile.entries()).sort((a, b) => {
98
+ const aTotal = a[1].reduce((sum, fn) => sum + fn.percentage, 0);
99
+ const bTotal = b[1].reduce((sum, fn) => sum + fn.percentage, 0);
100
+ return bTotal - aTotal;
101
+ });
102
+ for (const [file, functions] of sortedFiles) {
103
+ const totalPercent = functions.reduce((sum, fn) => sum + fn.percentage, 0);
104
+ const totalTicks = functions.reduce((sum, fn) => sum + fn.ticks, 0);
105
+ const percentColor = this.getPercentColor(totalPercent);
106
+ const percent = `${totalPercent.toFixed(1)}%`;
107
+ const ticks = `(${totalTicks.toLocaleString()} ticks)`;
108
+ // File header
109
+ const displayPath = this.formatPath(file);
110
+ this.printLine(`${this.colorize('magenta', ansiChars.block.dark)} ${this.colorize('brightMagenta', this.colorize('bold', displayPath)).padEnd(60)} ${this.colorize(percentColor, percent.padStart(6))} ${this.colorize('dim', ticks)}`);
111
+ // Functions in this file
112
+ for (const fn of functions) {
113
+ const fnPercent = `${fn.percentage.toFixed(1)}%`;
114
+ const fnTicks = `(${fn.ticks.toLocaleString()} ticks)`;
115
+ const lineInfo = fn.line ? `:${fn.line}` : '';
116
+ this.printLine(` ${this.colorize('magenta', ansiChars.smallSquare)} ${this.colorize('brightWhite', fn.name).padEnd(58)} ${this.colorize(this.getPercentColor(fn.percentage), fnPercent.padStart(6))} ${this.colorize('dim', fnTicks.padEnd(15))} ${this.colorize('dim', lineInfo)}`);
117
+ }
118
+ this.printLine();
119
+ }
120
+ this.printSummary(data);
121
+ }
122
+ printHeader(data) {
123
+ const header = `${this.colorize('magenta', ansiChars.block.full.repeat(2))} ${this.colorize('brightWhite', this.colorize('bold', 'Profile Analysis'))}`;
124
+ this.printLine(header);
125
+ this.printLine();
126
+ if (data.command) {
127
+ this.printLine(`Command: ${this.colorize('cyan', data.command)}`);
128
+ }
129
+ if (data.duration) {
130
+ const durationSec = (data.duration / 1000).toFixed(1);
131
+ this.printLine(`Duration: ${this.colorize('cyan', `${durationSec}s`)}`);
132
+ }
133
+ this.printLine(`Total Ticks: ${this.colorize('cyan', data.totalTicks.toLocaleString())}`);
134
+ }
135
+ printLine(text = '') {
136
+ console.log(text);
137
+ }
138
+ printSummary(data) {
139
+ if (data.totalShown === 0) {
140
+ this.printLine(`${this.colorize('dim', `No functions used at least ${data.minExecutionPercent}% of the ticks`)}`);
141
+ }
142
+ else {
143
+ this.printLine(`${this.colorize('dim', `... (showing top ${data.totalShown} of ${data.totalFiltered} user functions)`)}`);
144
+ }
145
+ }
146
+ }
147
+ //# sourceMappingURL=profile-human.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile-human.js","sourceRoot":"","sources":["../../src/reporters/profile-human.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,yBAAyB;AAarD;;GAEG;AACH,MAAM,OAAO,oBAAoB;IACd,WAAW,CAAU;IAErB,QAAQ,CAAU;IAEnC,YAAY,UAAkC,EAAE;QAC9C,IAAI,CAAC,QAAQ;YACX,OAAO,CAAC,KAAK;gBACb,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;oBACnB,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,GAAG;oBAC/B,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC;QAElC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,KAAK,CAAC;IAClD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAyB;QAC9B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,CAAC,SAAS,EAAE,CAAC;QAEjB,IAAI,I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AAC;QACpE,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACtD,IAAI,CAAC,SAAS,CAAC,aAAa,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,WAAW,GAAG,CAAC,EAAE,CAAC,CAAC;QAC1E,CAAC;QAED,IAAI,CAAC,SAAS,CACZ,gBAAgB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,EAAE,CAC1E,CAAC;IACJ,CAAC;IAEO,SAAS,CAAC,IAAI,GAAG,EAAE;QACzB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAEO,YAAY,CAAC,IAAyB;QAC5C,IAAI,IAAI,CAAC,UAAU,KAAK,CAAC,EAAE,CAAC;YAC1B,IAAI,CAAC,SAAS,CACZ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,8BAA8B,IAAI,CAAC,mBAAmB,gBAAgB,CAAC,EAAE,CAClG,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,SAAS,CACZ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,oBAAoB,IAAI,CAAC,UAAU,OAAO,IAAI,CAAC,aAAa,kBAAkB,CAAC,EAAE,CAC1G,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -37,6 +37,61 @@ class SimpleReporter extends reporter_registry_js_1.BaseReporter {
37
37
  this.verbose = options.verbose ?? false;
38
38
  this.quiet = options.quiet ?? false;
39
39
  }
40
+ /**
41
+ * Format bytes in human-readable format
42
+ */
43
+ static formatBytes(bytes) {
44
+ const units = ['B', 'KB', 'MB', 'GB', 'TB'];
45
+ let size = bytes;
46
+ let unitIndex = 0;
47
+ while (size >= 1024 && unitIndex < units.length - 1) {
48
+ size /= 1024;
49
+ unitIndex++;
50
+ }
51
+ return `${size.toFixed(1)} ${units[unitIndex]}`;
52
+ }
53
+ /**
54
+ * Format file path - show relative path if within CWD, otherwise absolute
55
+ */
56
+ static formatPath(filePath) {
57
+ const cwd = process.cwd();
58
+ const absolutePath = node_path_1.default.resolve(filePath);
59
+ // Check if the file is within the current working directory
60
+ if (absolutePath.startsWith(cwd + node_path_1.default.sep) || absolutePath === cwd) {
61
+ return node_path_1.default.relative(cwd, absolutePath);
62
+ }
63
+ return absolutePath;
64
+ }
65
+ /**
66
+ * Simple pluralization helper
67
+ */
68
+ static pluralize(str, count) {
69
+ return count === 1 ? str : `${str}s`;
70
+ }
71
+ onBudgetResult(summary) {
72
+ if (summary.total === 0 || this.quiet) {
73
+ return;
74
+ }
75
+ console.log('== Performance Budgets');
76
+ console.log();
77
+ for (const result of summary.results) {
78
+ const icon = result.passed ? symbols.checkmark : symbols.cross;
79
+ console.log(` ${icon} ${result.taskId}`);
80
+ if (!result.passed && result.violations.length > 0) {
81
+ for (const violation of result.violations) {
82
+ console.log(` ${violation.message}`);
83
+ }
84
+ }
85
+ }
86
+ console.log();
87
+ if (summary.failed === 0) {
88
+ console.log(` ${symbols.checkmark} All ${summary.total} budget(s) passed`);
89
+ }
90
+ else {
91
+ console.log(` ${symbols.cross} ${summary.failed} of ${summary.total} budget(s) failed`);
92
+ }
93
+ console.log();
94
+ }
40
95
  onEnd(run) {
41
96
  if (this.quiet) {
42
97
  return;
@@ -66,7 +121,7 @@ class SimpleReporter extends reporter_registry_js_1.BaseReporter {
66
121
  }
67
122
  console.log(`- Files: ${totalFiles}`);
68
123
  console.log(`- Suites: ${totalSuites}`);
69
- console.log(`${symbols.approx} Duration: ${this.formatDuration(duration * 1e6)}`);
124
+ console.log(`${symbols.approx} Duration: ${reporter_registry_js_1.BaseReporter.formatDuration(duration * 1e6)}`);
70
125
  console.log();
71
126
  if (totalFailed > 0) {
72
127
  console.log(`${symbols.cross.repeat(3)} Some benchmarks failed`);
@@ -76,7 +131,7 @@ class SimpleReporter extends reporter_registry_js_1.BaseReporter {
76
131
  console.log('Failed Tasks:');
77
132
  console.log();
78
133
  for (const failure of this.failures) {
79
- const displayPath = this.formatPath(failure.file);
134
+ const displayPath = SimpleReporter.formatPath(failure.file);
80
135
  console.log(` ${displayPath} > ${failure.suite} > ${failure.task}`);
81
136
  console.log(` ${failure.error}`);
82
137
  console.log();
@@ -107,7 +162,7 @@ class SimpleReporter extends reporter_registry_js_1.BaseReporter {
107
162
  console.log(` ${symbols.cross} ${totalFailed} failed, ${totalPassed} passed`);
108
163
  }
109
164
  else {
110
- console.log(` ${symbols.checkmark} ${totalPassed > 1 ? 'All ' : ''}${totalPassed} ${this.pluralize('task', totalPassed)} passed`);
165
+ console.log(` ${symbols.checkmark} ${totalPassed > 1 ? 'All ' : ''}${totalPassed} ${SimpleReporter.pluralize('task', totalPassed)} passed`);
111
166
  }
112
167
  console.log();
113
168
  }
@@ -116,13 +171,9 @@ class SimpleReporter extends reporter_registry_js_1.BaseReporter {
116
171
  if (this.quiet) {
117
172
  return;
118
173
  }
119
- const displayPath = this.formatPath(file);
174
+ const displayPath = SimpleReporter.formatPath(file);
120
175
  console.log(`-- ${displayPath}`);
121
176
  }
122
- onProgress(_state) {
123
- // Simple reporter does not display progress bars
124
- return;
125
- }
126
177
  onStart(run) {
127
178
  this.startTime = Date.now();
128
179
  this.failures = []; // Reset failures for new run
@@ -135,7 +186,7 @@ class SimpleReporter extends reporter_registry_js_1.BaseReporter {
135
186
  console.log(` node.js: ${run.environment.nodeVersion}`);
136
187
  console.log(` platform: ${run.environment.platform} ${run.environment.arch}`);
137
188
  console.log(` cpu: ${run.environment.cpu.model} (${run.environment.cpu.cores} cores)`);
138
- console.log(` mem: ${this.formatBytes(run.environment.memory.total)}`);
189
+ console.log(` mem: ${SimpleReporter.formatBytes(run.environment.memory.total)}`);
139
190
  console.log();
140
191
  }
141
192
  if (run.git) {
@@ -162,7 +213,7 @@ class SimpleReporter extends reporter_registry_js_1.BaseReporter {
162
213
  console.log(` ${symbols.cross} ${failed} failed, ${passed} passed`);
163
214
  }
164
215
  else {
165
- console.log(` ${symbols.checkmark} ${passed} ${this.pluralize('task', passed)} passed`);
216
+ console.log(` ${symbols.checkmark} ${passed} ${SimpleReporter.pluralize('task', passed)} passed`);
166
217
  }
167
218
  console.log();
168
219
  }
@@ -183,8 +234,10 @@ class SimpleReporter extends reporter_registry_js_1.BaseReporter {
183
234
  if (this.quiet) {
184
235
  return;
185
236
  }
186
- // Buffer the result for later printing with proper alignment
237
+ // Always buffer the result for suite summary (including aborted tasks)
187
238
  this.suiteResults.push(result);
239
+ // Note: Aborted tasks are still printed in simple reporter for completeness
240
+ // but they'll have zero stats
188
241
  }
189
242
  onTaskStart(task) {
190
243
  if (this.quiet) {
@@ -195,37 +248,6 @@ class SimpleReporter extends reporter_registry_js_1.BaseReporter {
195
248
  console.log(` - ${task}`);
196
249
  }
197
250
  }
198
- /**
199
- * Format bytes in human-readable format
200
- */
201
- formatBytes(bytes) {
202
- const units = ['B', 'KB', 'MB', 'GB', 'TB'];
203
- let size = bytes;
204
- let unitIndex = 0;
205
- while (size >= 1024 && unitIndex < units.length - 1) {
206
- size /= 1024;
207
- unitIndex++;
208
- }
209
- return `${size.toFixed(1)} ${units[unitIndex]}`;
210
- }
211
- /**
212
- * Format file path - show relative path if within CWD, otherwise absolute
213
- */
214
- formatPath(filePath) {
215
- const cwd = process.cwd();
216
- const absolutePath = node_path_1.default.resolve(filePath);
217
- // Check if the file is within the current working directory
218
- if (absolutePath.startsWith(cwd + node_path_1.default.sep) || absolutePath === cwd) {
219
- return node_path_1.default.relative(cwd, absolutePath);
220
- }
221
- return absolutePath;
222
- }
223
- /**
224
- * Simple pluralization helper
225
- */
226
- pluralize(str, count) {
227
- return count === 1 ? str : `${str}s`;
228
- }
229
251
  /**
230
252
  * Print all task results in a suite with aligned columns
231
253
  */
@@ -256,9 +278,9 @@ class SimpleReporter extends reporter_registry_js_1.BaseReporter {
256
278
  status,
257
279
  };
258
280
  }
259
- const duration = this.formatDuration(result.mean * 1e9);
260
- const opsPerSec = this.formatOpsPerSecond(result.opsPerSecond);
261
- const rme = this.formatPercentage(result.marginOfError * 100);
281
+ const duration = reporter_registry_js_1.BaseReporter.formatDuration(result.mean * 1e9);
282
+ const opsPerSec = reporter_registry_js_1.BaseReporter.formatOpsPerSecond(result.opsPerSecond);
283
+ const rme = reporter_registry_js_1.BaseReporter.formatPercentage(result.marginOfError); // already a percentage
262
284
  return {
263
285
  durationLen: duration.length,
264
286
  durationStr: duration,