Skip to content

Commit fb16006

Browse files
committed
docs: include simple reporter
1 parent 3c6c39c commit fb16006

File tree

9 files changed

+134
-22
lines changed

9 files changed

+134
-22
lines changed

cspell.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"CHANGELOG.md",
2828
"coverage",
2929
"dist",
30-
"docs",
30+
"/docs",
3131
"node_modules",
3232
"*.csv",
3333
"worktrees",
@@ -57,7 +57,12 @@
5757
"mnode",
5858
"mplatform",
5959
"mcpu",
60-
"mmem"
60+
"mmem",
61+
"pyplot",
62+
"ylabel",
63+
"xticks",
64+
"tolist",
65+
"seti"
6166
],
6267
"words": ["bupkis"]
6368
}

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@
179179
"**/!(.github/prompts)/*.md": [
180180
"prettier --write",
181181
"cspell"
182+
],
183+
"*.mdx": [
184+
"prettier --write",
185+
"cspell"
182186
]
183187
},
184188
"prettier": {

site/src/content/docs/getting-started/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ modestbench run "tests/**/*.bench.ts"
140140

141141
## View Results
142142

143-
modestbench provides a clean, colorized output:
143+
modestbench provides clean, colorized output in interactive terminals:
144144

145145
```text
146146
🚀 modestbench
@@ -174,6 +174,10 @@ Found 1 benchmark file(s)
174174
🎉 All benchmarks completed successfully!
175175
```
176176

177+
:::note[Output Format]
178+
The colorized output above is from the `human` reporter, used automatically in interactive terminals. In CI/CD or when piping output, modestbench uses the `simple` reporter for clean, plain-text output without colors.
179+
:::
180+
177181
## Common Options
178182

179183
### Control Benchmark Duration

site/src/content/docs/guides/advanced.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ const isProd = process.env.NODE_ENV === 'production';
274274
export default {
275275
iterations: isCI ? 5000 : 100,
276276
warmup: isCI ? 100 : 0,
277-
reporters: isCI ? ['json', 'csv'] : ['human'],
277+
reporters: isCI ? ['json', 'csv'] : ['simple'], // Simple reporter for CI, auto-detect for local
278278
quiet: isCI,
279279
outputDir: isCI ? './benchmark-results' : undefined,
280280

@@ -286,6 +286,10 @@ export default {
286286
};
287287
```
288288

289+
:::tip[Reporter Auto-Selection]
290+
You can omit the `reporters` option entirely to let modestbench auto-select based on the environment (TTY detection).
291+
:::
292+
289293
## CI/CD Integration
290294

291295
### GitHub Actions

site/src/content/docs/guides/cli.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,15 @@ modestbench run --reporters human,json,csv
132132

133133
Available reporters:
134134

135-
- `human` - Color-coded terminal output (default)
135+
- `human` - Color-coded terminal output (default for TTY with colors)
136+
- `simple` - Plain text output (default for non-TTY environments)
136137
- `json` - Structured JSON data
137138
- `csv` - Tabular CSV format
138139

140+
:::note[Auto-Selection]
141+
modestbench automatically selects `human` (TTY with color) or `simple` (non-TTY) as the default. Override with `--reporters` if needed.
142+
:::
143+
139144
##### `--output <directory>`
140145

141146
Directory path for saving benchmark results and reports.
@@ -158,8 +163,8 @@ Minimal output mode. Suppresses progress bars and non-essential messages.
158163
modestbench run --quiet
159164
```
160165

161-
:::note
162-
`--quiet` suppresses progress (stderr), not data output (stdout). Perfect for CI/CD pipelines.
166+
:::note[CI/CD Pipelines]
167+
In non-TTY environments, modestbench automatically uses the `simple` reporter which has no progress bars. `--quiet` further suppresses status messages for completely clean output.
163168
:::
164169

165170
##### `--verbose`

site/src/content/docs/guides/configuration.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,12 @@ Stop execution on first benchmark failure.
208208
#### `reporters`
209209

210210
**Type:** `string[]`
211-
**Default:** `["human"]`
211+
**Default:** Auto-selected based on environment
212212

213213
Array of reporter names to use for output. Available reporters:
214214

215-
- `human` - Color-coded terminal output with progress bars
215+
- `human` - Color-coded terminal output with progress bars (default for TTY with colors)
216+
- `simple` - Plain text output without colors (default for non-TTY environments)
216217
- `json` - Structured JSON data for programmatic analysis
217218
- `csv` - Tabular data for spreadsheets
218219

@@ -222,6 +223,10 @@ Array of reporter names to use for output. Available reporters:
222223
}
223224
```
224225

226+
:::note[Auto-Selection]
227+
When not specified, modestbench automatically selects `human` (TTY + color support) or `simple` (non-TTY). The `human` reporter is used when `FORCE_COLOR=1` even in non-TTY environments.
228+
:::
229+
225230
:::note[Multiple Reporters]
226231
You can use multiple reporters simultaneously! Results will be output in all specified formats.
227232
:::
@@ -256,6 +261,10 @@ Minimal output mode. Suppresses progress bars and non-essential messages on stde
256261
}
257262
```
258263

264+
:::tip[CI/CD Usage]
265+
In CI/CD environments, modestbench automatically uses the `simple` reporter which has no progress bars. Use `quiet` to further suppress status messages for completely clean output.
266+
:::
267+
259268
:::tip[quiet vs output]
260269
`quiet` suppresses progress (stderr), not data output (stdout). Use it in CI to reduce noise while still getting results.
261270
:::

site/src/content/docs/guides/output.md

Lines changed: 90 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,19 @@ description: Understanding modestbench reporter output formats
55

66
modestbench supports multiple output formats through its reporter system. You can use multiple reporters simultaneously to get results in different formats.
77

8-
## Human Reporter (Default)
8+
## Default Reporter Selection
99

10-
The human reporter provides color-coded terminal output with real-time progress bars and formatted results.
10+
modestbench automatically selects the appropriate reporter based on your environment:
11+
12+
- **Interactive terminals** (TTY with color support): `human` reporter with colors and progress bars
13+
- **Non-TTY environments** (CI/CD, piped output): `simple` reporter with plain text output
14+
- **Forced color mode** (`FORCE_COLOR=1`): `human` reporter even in non-TTY environments
15+
16+
You can always override the default by explicitly specifying `--reporters`.
17+
18+
## Human Reporter
19+
20+
The human reporter provides color-coded terminal output with real-time progress bars and formatted results. This is the default when running in an interactive terminal (TTY) with color support.
1121

1222
### Features
1323

@@ -70,9 +80,74 @@ modestbench run --reporters human --quiet
7080
- **stderr** - Progress bars and real-time updates
7181

7282
:::tip[CI/CD Usage]
73-
Use `--quiet` flag to suppress progress bars while keeping results output.
83+
In CI/CD environments, modestbench automatically uses the `simple` reporter for clean, parseable output. Use `--quiet` to suppress progress messages if using the `human` reporter explicitly.
7484
:::
7585

86+
## Simple Reporter
87+
88+
The simple reporter provides clean, text-only output without colors or progress bars. This is the default in non-TTY environments (CI/CD, piped output) or when `FORCE_COLOR` is not set.
89+
90+
### Features
91+
92+
- **Plain text output** - No ANSI colors or escape codes
93+
- **No progress bars** - Clean output suitable for logs and pipes
94+
- **Structured results** - Same hierarchy as human reporter (File → Suite → Task)
95+
- **Machine-readable** - Perfect for parsing and CI/CD logs
96+
97+
### Example Output
98+
99+
```text
100+
modestbench
101+
102+
Environment:
103+
Node.js: v24.10.0
104+
Platform: darwin arm64
105+
CPU: Apple M4 Max (16 cores)
106+
Memory: 48.0 GB
107+
108+
Found 1 benchmark file(s)
109+
110+
> benchmarks/example.bench.js
111+
112+
> Array Operations
113+
✓ Array.push()
114+
810.05μs ±2.45% (1.23M ops/sec)
115+
✓ Array spread
116+
81.01ms ±4.12% (12.34K ops/sec)
117+
✓ 2 passed
118+
119+
✓ All 2 tasks passed
120+
121+
Results
122+
123+
✓ All tests passed: 2
124+
Files: 1
125+
Suites: 1
126+
Duration: 1.82s
127+
128+
All benchmarks completed successfully!
129+
```
130+
131+
### Usage
132+
133+
```bash
134+
# Simple reporter is default in non-TTY environments
135+
modestbench run | tee results.log
136+
137+
# Explicitly specify simple reporter
138+
modestbench run --reporters simple
139+
140+
# Force human reporter in non-TTY (requires FORCE_COLOR=1)
141+
FORCE_COLOR=1 modestbench run --reporters human
142+
```
143+
144+
### When to Use
145+
146+
- **CI/CD pipelines** - Clean logs without ANSI codes
147+
- **Piped output** - `modestbench run | grep "passed"`
148+
- **Log files** - Readable output without color codes
149+
- **Automated parsing** - Consistent text format
150+
76151
## JSON Reporter
77152

78153
The JSON reporter outputs structured data perfect for programmatic analysis, CI/CD integration, and historical tracking.
@@ -383,8 +458,11 @@ modestbench run
383458
#### CI/CD
384459

385460
```bash
386-
# JSON + CSV for analysis, quiet mode
461+
# JSON + CSV for analysis (simple reporter used automatically)
387462
modestbench run --reporters json,csv --output ./results --quiet
463+
464+
# Or let auto-detection handle it
465+
modestbench run --output ./results
388466
```
389467

390468
#### Documentation
@@ -400,27 +478,30 @@ modestbench run --reporters human,json,csv --output ./benchmark-results
400478

401479
- **JSON reporter**: Writes to `{output}/results.json`
402480
- **CSV reporter**: Writes to `{output}/results.csv`
403-
- **Human reporter**: Still writes to stdout/stderr
481+
- **Human/Simple reporters**: Still write to stdout/stderr
404482

405483
### When `--output` is NOT Specified
406484

407485
- **JSON reporter**: Writes to stdout
408486
- **CSV reporter**: Writes to stdout
409-
- **Human reporter**: Writes to stdout/stderr
487+
- **Human/Simple reporters**: Write to stdout/stderr
410488

411489
:::caution[Multiple Data Reporters]
412490
Using both JSON and CSV without `--output` will mix their output on stdout. Always use `--output` when using multiple data reporters.
413491
:::
414492

415493
### Quiet Mode
416494

417-
The `--quiet` flag affects only the human reporter:
495+
The `--quiet` flag affects the human and simple reporters:
418496

419-
- Suppresses progress bars (stderr)
420-
- Suppresses status messages
497+
- Suppresses progress bars and status messages (stderr)
421498
- Keeps final results output
422499
- Does NOT affect JSON or CSV output
423500

501+
:::note[Simple Reporter]
502+
The `simple` reporter has no progress bars by default, so `--quiet` primarily affects status messages.
503+
:::
504+
424505
## Next Steps
425506

426507
- Learn about [Configuration](/guides/configuration/) for reporter setup

site/src/content/docs/index.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ import { Card, CardGrid } from '@astrojs/starlight/components';
2525
High-precision timing with statistical analysis powered by `tinybench`. Get reliable measurements you can trust.
2626
</Card>
2727

28-
<Card title="Multiple Output Formats" icon="document">
29-
Generate human-readable, JSON, and CSV reports simultaneously. Perfect for
30-
CI/CD and analysis tools.
28+
<Card title="Multiple Output Formats" icon="document">
29+
Generate human-readable, simple text, JSON, and CSV reports simultaneously. Auto-detects environment for optimal output.
3130
</Card>
3231

3332
<Card title="Historical Tracking" icon="seti:clock">

site/src/content/docs/reference/api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ console.log(`Completed ${result.summary.totalTasks} benchmarks`);
4949
The main package exports:
5050

5151
- `modestbench()` - Create a benchmark engine instance
52-
- `HumanReporter` - Color-coded terminal reporter
52+
- `HumanReporter` - Color-coded terminal reporter (TTY with colors)
53+
- `SimpleReporter` - Plain text reporter (non-TTY environments)
5354
- `JsonReporter` - Structured JSON output reporter
5455
- `CsvReporter` - Tabular CSV output reporter
5556
- Type definitions for TypeScript

0 commit comments

Comments
 (0)