1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 20:15:07 +00:00

feat: add JSON output tests and README docs for analyze and status (#556)

* feat: add JSON output tests and README docs for analyze and status

Add 7 BATS tests covering `--json` output for `mo analyze` and `mo status`:
- schema structure
- field types
- pipe auto-detection.

Also document the `--json` flag in a new "Machine-Readable Output" README section, including the auto-detection behavior when piped.

* chore: use waitgroup go in status collector

---------

Co-authored-by: Tw93 <hitw93@gmail.com>
This commit is contained in:
Dylan Joss
2026-03-12 20:40:41 -07:00
committed by GitHub
parent cce26022f3
commit 7350547458
3 changed files with 179 additions and 4 deletions

View File

@@ -255,9 +255,7 @@ func (c *Collector) Collect() (MetricsSnapshot, error) {
// Helper to launch concurrent collection.
collect := func(fn func() error) {
wg.Add(1)
go func() {
defer wg.Done()
wg.Go(func() {
defer func() {
if r := recover(); r != nil {
errMu.Lock()
@@ -279,7 +277,7 @@ func (c *Collector) Collect() (MetricsSnapshot, error) {
}
errMu.Unlock()
}
}()
})
}
// Launch independent collection tasks.