CodeVetter · Repo Unpack · Behavior traces
gotestyourself/gotestsum
Source inspection followed startup and ordinary execution, targeted reruns, report persistence, watch-triggered execution, and both analysis tools. The normal path separates stream scanning from process waiting and final reporting. Reruns preserve historical Execution state while tracking only current retry failures for continuation. Watch mode follows its own execution path and therefore has different option behavior.
- Startup follows main → route → cmd.Run → setupFlags → Parse → setupLogging; version requests return early, watch requests call runWatcher, and other requests call run.
- Ordinary execution follows run → Validate → goTestCmdArgs → startGoTestFn → newEventHandler → ScanTestOutput → Flush → Wait; without arguments it constructs go test -json with ./... unless package selection overrides it.
- Malformed stdout normally causes readStdout to fail and stopOnError to cancel the child; ignore mode forwards malformed lines to Err, while FAIL-prefixed bad events are handled by a separate continue branch.
- After a failed initial process, run checks hasErrors and the initial failure limit, then rerunFailed filters failures, builds escaped anchored -test.run expressions, starts each retry, scans into shared Execution with a new RunID, and records remaining failures.
- Persistence completes through handler.Flush → finishRun → PrintSummary → writeJUnitFile → junitxml.Write → postRunHook; JUnit or hook errors replace the pending process error, otherwise finishRun returns it.
- Watch execution follows runWatcher → filewatcher.Watch → loadPaths → handleEvent → runTests → watchRuns.run → runSingle; changed .go paths trigger package runs, and watch-chdir sets the child directory and selector ./.
- Slow-test analysis follows slowest.Run → run → jsonfileReader → ScanTestOutput → aggregate.Slowest; --skip-stmt adds parseSkipStatement → writeTestSkip → packages.Load → rewriteAST → writeFile instead of printing.
- Matrix generation follows matrix.Run → run → readPackages → readTimingReports → packageTiming → packagePercentile → bucketPackages → writeMatrix; fewer than two partitions or an empty timing pattern fails before reading inputs.