testwhy

command
v0.182.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command testwhy reads a `go test` log and refuses to let a COUNT of failures stand in for knowing WHICH failures they are.

⛔⛔ "SAME NUMBER OF FAILURES AS BEFORE" IS NOT A MEASUREMENT. Measured on 2026-11-12, deciding whether a dependency bump was safe to merge: the suite had a known local breakage (a broken node binary killing every browser-driven test), I read the log by eye, and reported "18 failures, 0 non-browser, same as before". The file held 21 `--- FAIL` lines. The count was wrong, and worse, it was the only criterion — so "unchanged" would have covered a NEW failure arriving under the old total. What matters is the NAMES and their CAUSE.

testwhy -log out.txt -cause node=libsimdjson
go test ./... 2>&1 | tee out.txt ; testwhy -log out.txt -cause node=libsimdjson

Every failure whose output contains a named cause's substring is attributed to it. Every failure left over is printed and the exit status is 1: an unexplained failure is the finding.

Three things it gets right that reading by eye does not

⛔ A PARENT CARRIES NO MESSAGE OF ITS OWN. `--- FAIL: T` printed above `--- FAIL: T/case-1` has an empty body; the cause belongs to the subtest. The first version of this program reported such a parent as unexplained, which is not merely noisy — it sends you hunting a regression that does not exist. A parent is attributed when it HAS subtests and EVERY one of them is attributed; a parent with one unattributed subtest stays unattributed, because that subtest is the real finding.

⛔ A PACKAGE THAT DOES NOT BUILD PRINTS NO `--- FAIL` AT ALL. `FAIL pkg [build failed]` has no test names under it, so a program that counts FAIL lines reports zero failures and exits 0 on a package that compiled nothing. That is the same shape as a scan that could not read reporting a clean sweep. A build failure is always unexplained, whatever causes are named.

⛔ AND THE TIME IS A WITNESS. A package that should take seconds and returns in 0.0s ran nothing. The elapsed time of every package is printed, and -min-seconds refuses a package that finished faster than it plausibly could.

Exit status: 0 every failure is attributed (or there are none), 1 something is unexplained, 2 the arguments or the log could not be read.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL